mt6735 L版本通知音设置SD卡铃声后,蓝牙传文件无声
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
L版本通知音设置SD卡铃声后,蓝牙传文件无声
[SOLUTION]
bluetoothOppNotification.java
1.import android.provider.Settings;
import android.media.RingtoneManager;
2, 在updateIncomingFileConfirmNotification函数的末尾部分mNotificationMgr.notify(id, n);之前添加如下:
intent.setDataAndNormalize(contentUri);
n.deleteIntent = PendingIntent.getBroADCast(mContext, 0, intent, 0);
//add start
String ringtone;
Uri defaultRingtoneUri = Settings.System.DEFAULT_NOTIFICATION_URI;
int type = RingtoneManager.getDefaultType(defaultRingtoneUri );
Uri ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(mContext, type);
Log.d(TAG, "getActualDefaultRingtoneUri. ringtoneUri="+ringtoneUri+ " type=" + type);
if(RingtoneManager.isRingtoneExist(mContext, ringtoneUri)){
n.defaults &= ~Notification.DEFAULT_SOUND;
}else{
n.defaults |= Notification.DEFAULT_SOUND;
Log.d(TAG, "getActualDefaultRingtoneUri. use default");
}
ringtone = ringtoneUri.toString();
n.sound =Uri.parse(ringtone);
//add end
mNotificationMgr.notify(id, n);
L版本通知音设置SD卡铃声后,蓝牙传文件无声
[SOLUTION]
bluetoothOppNotification.java
1.import android.provider.Settings;
import android.media.RingtoneManager;
2, 在updateIncomingFileConfirmNotification函数的末尾部分mNotificationMgr.notify(id, n);之前添加如下:
intent.setDataAndNormalize(contentUri);
n.deleteIntent = PendingIntent.getBroADCast(mContext, 0, intent, 0);
//add start
String ringtone;
Uri defaultRingtoneUri = Settings.System.DEFAULT_NOTIFICATION_URI;
int type = RingtoneManager.getDefaultType(defaultRingtoneUri );
Uri ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(mContext, type);
Log.d(TAG, "getActualDefaultRingtoneUri. ringtoneUri="+ringtoneUri+ " type=" + type);
if(RingtoneManager.isRingtoneExist(mContext, ringtoneUri)){
n.defaults &= ~Notification.DEFAULT_SOUND;
}else{
n.defaults |= Notification.DEFAULT_SOUND;
Log.d(TAG, "getActualDefaultRingtoneUri. use default");
}
ringtone = ringtoneUri.toString();
n.sound =Uri.parse(ringtone);
//add end
mNotificationMgr.notify(id, n);
路过!