以下代码在果冻bean上正常工作-通知打开timeractivity。
但是在kitkat上,此代码将打开main活动。这是虫子吗?

mBuilder = new NotificationCompat.Builder(getApplicationContext())
    .setSmallIcon(ongoingNotificationIcon)
    .setContentTitle(ongoingNotificationContentTitle)
    .setContentText(ongoingNotificationContentText)
    .setTicker(ongoingNotificationTicker)
    .setPriority(99)
    .setOngoing(true)
    ;

Intent resultIntent = new Intent(this, TimerActivity.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addParentStack(TimerActivity.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0,Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mBuilder.setContentIntent(resultPendingIntent);
timerNotification = mBuilder.build();
startForeground(NOTIFICATION_ID, timerNotification);

最佳答案

这与这里的问题类似:
http://code.google.com/p/android/issues/detail?id=61850
http://code.google.com/p/android/issues/detail?id=63236
建议的解决方法是取消现有的挂起意图,或使用
PendingIntent.Flag_Cancel_当前

07-24 09:33