Уведомление Android перезапускает приложение, но хочет возобновить работу

Привет, мне удалось получить уведомление о моих действиях, нажимает на уведомление о перезапуске приложения. Однако я просто хочу, чтобы он появился снова, а не перезапускался. например. это веб-приложение, и я хочу, чтобы оно появлялось на переднем плане, когда пользователь выбирает уведомление ... но не обновляет веб-страницу. Могу ли я поймать это намерение, или я отправляю неправильное намерение? Обычно, если я нажимаю кнопку «Домой» и щелкаю значок приложения, приложение выходит на передний план и не обновляется / не перезапускается. Я хочу именно такого поведения. Есть идеи?

 String ns = Context.NOTIFICATION_SERVICE;
 NotificationManager mNotificationManager = (NotificationManager)
                                             getSystemService(ns);
 //2.Instantiate the Notification
 int icon = R.drawable.notification_icon;
 CharSequence tickerText = "My App";  // temp msg on status line 
 long when = System.currentTimeMillis();
 Notification notification = new Notification(icon, tickerText, when);
 notification.flags |= Notification.FLAG_ONGOING_EVENT;
 //3.Define the Notification's expanded message and Intent: 
 Context context = getApplicationContext();
 CharSequence contentTitle = "Notification";
 CharSequence contentText = "My app!"; // message to user
 Intent notificationIntent = new Intent(this, HelloAndroid2.class);
 PendingIntent contentIntent = PendingIntent.getActivity(this, 0, 
                                                          notificationIntent, 0);
 notification.setLatestEventInfo(context, contentTitle, contentText,
                                                          contentIntent);
 //4.Pass the Notification to the NotificationManager:  
 final int NOTIFICATION_ICON_ID = 1;
 mNotificationManager.notify(NOTIFICATION_ICON_ID, notification);
18
задан Mr_and_Mrs_D 19 July 2013 в 15:42
поделиться