Firebase JobDispatcher は、Androidアプリでバックグラウンドジョブをスケジュールするためのライブラリです。 Google Play Services がインストールされているすべての最新バージョンのAndroid(APIレベル9以上)で動作するAPIレベル21のJobScheduler互換APIを提供しています。
Firebase JobDispatcherは、Google Play Services のスケジュールコンポーネントに依存しています。そのため、Google Play Servicesがインストールされていない環境では動作しません。
Firebase JobDispatcherは、APIレベル21以上のAndroidで実行された場合、FrameworkのJobScheduler を使用しているわけではありません。Google Play Servicesに依存してます。
その為、以下のコマンドを実行しても、Firebase JobDispatcher で、スケジュールされたJobの確認することはできません。
adb shell dumpsys jobscheduler
以下のコマンドを実行する必要があります。
adb shell dumpsys activity service GcmService
スケジュールされていると、Pending:のセグメントに追加されています。
Pending:
~
(scheduled) net.granoeste.jobdispatchersample/com.firebase.jobdispatcher.GooglePlayReceiver{u=0 tag="MainFirebaseSimpleJobService" trigger=window{start=0s,end=60s,earliest=-3s,latest=56s} requirements=[NET_CONNECTED] attributes=[PERSISTED,RECURRING] scheduled=-3s last_run=N/A jid=N/A status=PENDING retries=0 client_lib=FIREBASE_JOB_DISPATCHER-1}
Not yet run.
実行中は、Active tasks:に表示されます。
Active tasks:
net.granoeste.jobdispatchersample/com.firebase.jobdispatcher.GooglePlayReceiver, u0 running: 00:05
終了すると、Past executions:に追加され、次のスケジュールがPending:のセグメントに登録されていることが確認できます。
Pending:
~
(scheduled) net.granoeste.jobdispatchersample/com.firebase.jobdispatcher.GooglePlayReceiver{u=0 tag="MainFirebaseSimpleJobService" trigger=window{start=0s,end=60s,earliest=57s,latest=117s} requirements=[NET_CONNECTED] attributes=[PERSISTED,RECURRING] scheduled=57s last_run=N/A jid=N/A status=PENDING retries=0 client_lib=FIREBASE_JOB_DISPATCHER-1}
Not yet run.
Past executions:
~
(finished) [net.granoeste.jobdispatchersample/com.firebase.jobdispatcher.GooglePlayReceiver:MainFirebaseSimpleJobService,u0]
successes: 2 reschedules: 0 failures: 0 timeouts: 0 invalid_service: 0 total_runtime_millis: 60195
参考)