서비스를 시작하지 못하는 간단한 IntentService 스켈레톤을 만들었습니다. 메인 코드 블록과 매니페스트 항목을 추가했지만 아직 로그 출력을 얻지 못했습니다. 여기 다른 유사한 답변을 확인하지만 한 나는에 항목 추가하는 매니페스트에 모든 점 :InsentService가 호출되지 않았지만 Manifest에 있음
매니페스트 :
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name=".ApplicationGlobal">
<service android:name=".MyIntentServiceImpl" />
서비스 시작 :
Intent intent = new Intent(ThisActivity.this, MyIntentServiceImpl.class);
startService(intent);
서비스 코드 :
public class MyIntentServiceImpl extends IntentService implements MyIntentService {
private boolean result;
private Long pollingCount;
public MyIntentServiceImpl(){
super("MyIntentServiceImpl ");
Log.d(TAG, "Creating Polling Service");
this.result = false;
this.pollingCount = 0L;
}
@Override
protected void onHandleIntent(Intent arg0) {
Log.d(TAG, "Polling Service Started");
while(!result && (pollingCount <= MAX_POLLING_VALUE)){
pollingCount++;
Log.d(TAG, "Polling for Result Request (" + pollingCount.toString() + ")");
}
Log.d(TAG, "Polling Service Finished");
LogCat을 검사하고'startService()'호출 시점의 메시지를 찾으십시오. – CommonsWare