如何从通知中恢复Android应用?我希望能够从它离开的地方恢复实例,包括所有有界服务和设置等。而不是一个完整的新实例。这是我的代码:
String ns = Context.NOTIFICATION_SERVICE;
mNotificationManager = (NotificationManager)
getSystemService(ns);
Intent notificationIntent = new Intent(this, MeasurementsStarter.class);
PendingIntent contentIntent = PendingIntent.getActivity(
this, 0, notificationIntent, 0);
// the next two lines initialize the Notification, using the configurations
// above
notification = new Notification(R.drawable.ic_launcher, "Metingen draaien",System.currentTimeMillis());
notification.setLatestEventInfo(getBaseContext(), "Metingen ManDown", "Metingen Mandown draaien nog",
contentIntent);
notification.flags = Notification.FLAG_ONGOING_EVENT | Notification.FLAG_NO_CLEAR;
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
final int HELLO_ID = 1;
mNotificationManager.notify(HELLO_ID, notification);
答案 0 :(得分:0)
我找到了答案,我手动设置了所有textFields等数据,并将我的bindService放在我的onCreate()方法中。它可能不是最优雅的方式,但它仍然有效