サービスの開始に失敗する単純な IntentService スケルトンを作成しました。呼び出し、メイン コード ブロック、およびマニフェスト エントリを追加しましたが、まだログ出力が得られません。ここで他の同様の回答を確認しましたが、すべてエントリを追加したマニフェストを指しています。
マニフェスト:
<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");