2013-10-24 3 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

, 나는 수동 등 내 텍스트 필드의 모든에서 데이터를 설정하고 단지 내에서 onCreate() 메소드 내 bindService을 넣어. 그것은 propably 가장 graceous 방법이 아니지만, 그럼에도 불구하고 작동