2010-08-10 5 views
3

012ay이 (가) 백그라운드에서 실행 중이지만과 MyClient이 모두 실행 중입니다. MyService을 통해 MyClient에 텐트를 보내는 경우 :Android : startActivity()를 통해 인 텐트를 실행중인 Activity로 전달하는 방법?

Intent i = new Intent(MYService.this, MyClient.class); 
i.setAction("com.test.MyService.ACTION_SERVICE"); 
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); 
startActivity(i); 

어떻게하여 MyClient이 의도를받을 수 있나요? 이 코드를 실행하면 MyClient에서 onResume()을 트리거하지만 때문에 이미 getIntent() 반환 항상 android.intent.action.MAIN

답변

7

재정의 onNewIntent()를 만드는 것입니다 처음하여 MyClient를 만든 의도를 호출, 실행은 '아무튼 있도록 의도를 플래그 확인 새로운 활동을 시작하십시오.

관련 문제