我有一个 android 程序,我在 web 上从外部服务器的数据库接收一条消息,然后我将消息放入 SMS 收件箱。
现在我像这样使用系统通知:
通知 Intent :
ctx = context ;
notificationManager = (NotificationManager) ctx
.getSystemService(Context.NOTIFICATION_SERVICE);
syncNotification = new Notification();
notificationIntent = new Intent(Intent.ACTION_MAIN,null);
notificationIntent.setComponent(new ComponentName("com.android.mms","com.android.mms.ui.ConversationList"));
notificationIntent.addFlags(Notification.FLAG_AUTO_CANCEL);
contentIntent = PendingIntent.getActivity(ctx, 0,
notificationIntent, 0);
通知创建:
syncNotification.icon = android.R.drawable.stat_notify_chat;
syncNotification.tickerText = ctx.getText(R.string.new_message);
syncNotification.when = System.currentTimeMillis();
syncNotification.setLatestEventInfo(ctx, ctx.getText(R.string.new_message), ctx.getText(R.string.check_your_inbox),contentIntent);
notificationManager.notify(5, syncNotification);
然后播放短信铃声:
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone r = RingtoneManager.getRingtone(ctx, notification);
r.play();
收到消息并将其放入收件箱后,显示了通知,但是当我点击它时没有任何反应。
有没有办法在将消息插入收件箱后,设备显示默认通知并进行管理?
最佳答案
在 android api 14 及更高版本中这是不可能的,因为谷歌阻止了。
关于android - 将新消息放入收件箱,然后设备对其进行管理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18149564/