2017-03-06 2 views
0

로그를 검사했습니다. onHandleIntent() 대신 onDestroy() 메소드가 호출됩니다. 두 개의 인 텐트 서비스를 사용하고 있는데 둘 다 비슷한 코드가 작성되었지만 하나만 실행됩니다. 항상 두 번째 intentService (코드 첨부) ... 가끔은 실행되며 전체 프로젝트에서 아무 것도 변경하지 않는 경우도 있습니다. 아무도 도와 줄 수 있습니까?안드로이드 IntentService onDestroy가 onHandleIntent 대신에 호출 됨

public class GetDataService extends IntentService { 
    private static final String TAG="GetDataService"; 

    public GetDataService(){ 
     super("GetDataService"); 
    } 
    @Override 
    protected void onHandleIntent(Intent intent) { 
     GetDataTask task= new GetDataTask(); 
     Log.d(TAG,intent.getStringExtra(GetDataTask.INSTA_TOKEN_URL)); 
     task.execute(this,intent); 
     ApplicaitonsData.GetDataServiceRunning=true; 
     Log.d(TAG,"data service running status = "+ ApplicaitonsData.GetDataServiceRunning); 
    } 

    @Override 
    public void onDestroy() { 
     super.onDestroy(); 
     ApplicaitonsData.GetDataServiceRunning=false; 
     Log.d(TAG,"data service running status = "+ApplicaitonsData.GetDataServiceRunning); 
    } 
} 

답변

0

코드의 task.execute() 메소드에는 if 루프가 있고 조건은 false입니다. IntentService가 수행 할 내용이 없었기 때문에 자체를 파괴하고있었습니다.

관련 문제