y-tomimoto / TAKITATE

sandbox for android tutorial
0 stars 1 forks source link

Backgroundで定期的に位置情報を取得し、shared pref に保存する #15

Closed y-tomimoto closed 4 years ago

y-tomimoto commented 4 years ago

前回の調査では、Backgroundで定期的に位置情報を取得できる感覚が、15分だった。

https://developer.android.com/about/versions/oreo/background-location-limits?hl=ja

https://github.com/codepath/android_guides/issues/220

Background でサービスを処理するときの全ライブラリ 20/10/01

https://developer.android.com/topic/libraries/architecture/workmanager?hl=ja

onStartJob内では非同期でタスクを実行すること

Note: Your JobService will run on the main thread. That means that you need to manage any asynchronous tasks yourself (like using a Thread or AsyncTask to open a network connection, and then returning true) within your onStartJob() method.

https://medium.com/google-developers/scheduling-jobs-like-a-pro-with-jobscheduler-286ef8510129

y-tomimoto commented 4 years ago

JobScheduler のテスト

https://stackoverflow.com/questions/38880969/what-tools-are-available-to-test-jobscheduler

y-tomimoto commented 4 years ago

test用のcom

adb shell cmd jobscheduler run -f io.github.reservationbytom 0

adb shell dumpsys jobscheduler | grep io.grep.reservationbytom