2013-10-24 50 views
1

如何從通知恢復Android應用程序?我希望能夠從剩餘的實例中恢復實例,包括所有有界的服務和設置等,而不是一個完整的新實例。這是我的代碼:從通知恢復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

我有種找到了答案,我手動從我所有的文本框等的設置數據,只是把我的bindService在我的onCreate()方法。這可能不是最優雅的方式,但它仍然有效