Android 如何设置视频来电的默认铃声
前言
欢迎大家我分享和推荐好用的代码段~~
声明
欢迎转载,但请保留文章原始出处:
CSDN:http://www.csdn.net
雨季o莫忧离:http://blog.csdn.net/luckkof
正文
PRODUCT_PROPERTY_OVERRIDES := \
ro.config.notification_sound=Proxima.ogg \
ro.config.alarm_alert=Alarm_Classic.ogg \
ro.config.ringtone=Backroad.ogg \
ro.config.video_call=VideocallRt.ogg
1),添加成员变量用做后面的判断:
private String mDefaultRingtoneFilename;
private String mDefaultVideocallFilename;
private boolean mDefaultVideoCallSet;
private static final String VIDEOCALL_SET = "videocall_set";
2):添加读取video call默认铃声的系统属性:
mDefaultRingtoneFilename = SystemProperties.get(DEFAULT_RINGTONE_PROPERTY_PREFIX
+ Settings.System.RINGTONE);
mDefaultVideocallFilename = SystemProperties.get(DEFAULT_RINGTONE_PROPERTY_PREFIX
+ Settings.System.VIDEO_CALL);//add this line
...
}
private Uri endFile(){
boolean videocall = false; //add this line
.....
if (notifications &&((mWasEmptyPriorToScan && !mDefaultNotificationSet) ||
doesSettingEmpty(NOTIFICATION_SET))) {
....
} else if(ringtones && ((mWasEmptyPriorToScan && (!mDefaultRingtoneSet||!mDefaultVideoCallSet)) || doesSettingEmpty(RINGTONE_SET)|| doesSettingEmpty(VIDEOCALL_SET))) {
if (TextUtils.isEmpty(mDefaultRingtoneFilename) ||
doesPathHaveFilename(entry.mPath, mDefaultRingtoneFilename)) {
needToSetSettings = true;
/// M: Adds log to debug setting ringtones.
Xlog.v(TAG, "endFile: needToSetRingtone=true.");
}
doesPathHaveFilename(entry.mPath, mDefaultVideocallFilename)) {
videocall = true;
Xlog.v(TAG, "endFile: needToSetRingtone=true.");
}
} else if (alarms && ((mWasEmptyPriorToScan && !mDefaultAlarmSet) ||
doesSettingEmpty(ALARM_SET))) {
...
}
if(needToSetSettings) {
if (notifications && doesSettingEmpty(NOTIFICATION_SET)) {
.....
} else if (ringtones && (doesSettingEmpty(RINGTONE_SET)||doesSettingEmpty(VIDEOCALL_SET)) {
mDefaultVideoCallSet = true;
setSettingFlag(VIDEOCALL_SET);
setSettingIfNotSet(Settings.System.RINGTONE, tableUri, rowId);
// setSettingIfNotSet(Settings.System.VIDEO_CALL, tableUri, rowId); //modify this line
setSettingIfNotSet(Settings.System.SIP_CALL, tableUri, rowId);
setProfileSettings(RingtoneManager.TYPE_RINGTONE, tableUri, rowId);
// setProfileSettings(RingtoneManager.TYPE_VIDEO_CALL, tableUri, rowId);//modify this line
setProfileSettings(RingtoneManager.TYPE_SIP_CALL, tableUri, rowId);
mDefaultRingtoneSet = true;
setSettingFlag(RINGTONE_SET);
Xlog.v(TAG, "endFile: set ringtone. uri=" + tableUri + ", rowId=" + rowId);
}else if (alarms && doesSettingEmpty(ALARM_SET)) {
....
}
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。