3

我有一个 android 程序,在其中我从 web 上的外部服务器上的数据库接收消息,然后我将消息放入 SMS 收件箱。

现在我使用这样的系统通知:

通知意图:

    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();

收到消息并将其放入收件箱后,会显示通知,但是当我点击它时什么也没做。

有没有办法在将消息插入收件箱后,设备显示默认通知并进行管理?

4

1 回答 1

1

在 android api 14 及更高版本中这是不可能的,因为谷歌阻止了 .

于 2014-12-02T11:22:54.697 回答