[英]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.