[英]sound notification when message received from mixpanel
我在我的android應用程序代碼中集成了mixpanel,並且收到推送通知,但是我想在消息到達時聽到默認的通知聲音。 因此,我添加了以下內容:
public class notificationReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent MainActivity) {
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context);
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
mBuilder.setSound(notification);
Ringtone r = RingtoneManager.getRingtone(context.getApplicationContext(), notification);
r.play(); }
}
混合面板通知不起作用的任何原因是什么? 謝謝!
您必須在通知生成器中添加此行代碼
mBuilder.setSound(Settings.System.DEFAULT_NOTIFICATION_URI);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.