【发布时间】:2015-10-28 20:28:47
【问题描述】:
我以这种方式在 Service 中创建通知(从 BroadcastReceiver 启动):
this.notification = new NotificationCompat.Builder(getApplicationContext())
.setContentTitle("Foo")
.setContentText("Bar")
.setSmallIcon(R.drawable.logo)
.setContentIntent(pIntent)
.build();
this.initializeNotificationSound(volumne, Uri.parse(melody));
this.initializeNotificationVibration();
notification.flags = Notification.FLAG_INSISTENT;
this.notificationManager.cancelAll();
this.notificationManager.notify(0, notification);
收到特定短信时设置此通知。我想创建一个通知,它将播放定义的旋律并且不会被标准 SMS 通知打断。
这个功能效果很好,但是在棒棒糖中,会发生以下情况:
- 收到短信
- 我的通知已启动
- 一段时间后,通知声音停止并播放默认短信铃声
仅当铃声模式为静音时才会发生这种情况。否则,它会按预期工作,因为 cancelAll() 方法会中断 SMS 通知。
提前感谢您的回复。
【问题讨论】:
标签: android notifications sms android-5.0-lollipop persistent