Android 将新邮件放入收件箱,然后对其进行设备管理
我有一个android程序,在这个程序中,我从网络上的外部服务器上的数据库接收一条消息,然后将消息放入SMS收件箱 现在我使用的系统通知如下: 通知意图:Android 将新邮件放入收件箱,然后对其进行设备管理,android,android-intent,android-notifications,android-broadcast,Android,Android Intent,Android Notifications,Android Broadcast,我有一个android程序,在这个程序中,我从网络上的外部服务器上的数据库接收一条消息,然后将消息放入SMS收件箱 现在我使用的系统通知如下: 通知意图: ctx = context ; notificationManager = (NotificationManager) ctx .getSystemService(Context.NOTIFICATION_SERVICE); syncNotification = new Notification
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及更高版本中,这是不可能的,因为谷歌阻止了