Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WorkManager

takahirom
May 22, 2018
2.8k

 WorkManager

takahirom

May 22, 2018
Tweet

Transcript

  1. 荈ⴓחאְג ˖ UBLBIJSPN !OFX@SVOOBCMF  ˖ 劤せכ嬁「䃨峔 ׭׿ׄױ׋ַמ׹  ˖

    "OESPJEָ㥨ֹדׅկ ˖ "CFNB57ך"OESPJE،فٔ׾⡲׏גְתׅկ ˖ ջ(PPHMF*0ًٌ 끅ְ׋הֿ׹ռהְֲ 2JJUB׾剅ֹת׃׋
  2. ˖ غحؙؚٓؐٝسדװ׷ץֹֿהכ׋ֻׁ׿֮׷ ˖ ؚٗ鷏⥋ծ،حفٗ٦سծر٦ةず劍ծر٦ة׾Ⳣ椚ׅ׷ ˖ ׋ֻׁ׿غحؙؚٓؐٝسד㹋遤ׅ׷倯岀ָ֮׷ ˖ 5ISFBE &YFDVUPS 4FSWJDF

    "TZOD5BTLזו ⦐ּ׵ְ֮ ׷  ˖ "OESPJEךغحذٔ٦剑黝⻉ך堣腉׮׋ֻׁ׿֮׷ ˖ %P[FNPEF "QQTUBOECZ -JNJUFEJNQMJDJUCSPBEDBTUT  3FMFBTFDBDIFEXBLFMPDLT 1ד涪邌ׁ׸׋׮ך׾ろ׭׷ הծ֮ה ⦐ּ׵ְ֮׷ %FGFSSBCMFHVBSBOUFFEFYFDVUJPO ך⡦ָ㉏겗ַ
  3. ˖ ة؎ىָؚٝ䖓חז׏ג׮״ֻծ⹛⡲ׅ׷ֿהָ⥂鏾׃׋ְ㜥 さ׋ֻׁ׿ך鍑寸倯岀ָ֮׷կ ˖ +PC4DIFEVMFS 'JSFCBTF+PC%JTQBUDIFS "MBSN.BOBHFS  #SPBEDBTU3FDFJWFST ˖

    ⟃♴ך״ֲז鍑寸ٗآحؙ׾荈ⴓד剅ְגծ׋ֻׁ׿ךֿה׾ 罋䣁׃זָ׵׋ֻׁ׿ך"1*ךㄎן⳿׃׾剅ֻ䗳銲ָ֮׷կ %FGFSSBCMFHVBSBOUFFEFYFDVUJPO ך⡦ָ㉏겗ַ
  4. ˖ ة؎ىָؚٝ䖓חז׏ג׮״ֻծ⹛⡲ׅ׷ֿהָ⥂鏾׃׋ְ㜥 さ׋ֻׁ׿ך鍑寸倯岀ָ֮׷կ ˖ +PC4DIFEVMFS 'JSFCBTF+PC%JTQBUDIFS "MBSN.BOBHFS  #SPBEDBTU3FDFJWFST ˖

    ⟃♴ך״ֲז鍑寸ٗآحؙ׾荈ⴓד剅ְגծ׋ֻׁ׿ךֿה׾ 罋䣁׃זָ׵׋ֻׁ׿ך"1*ךㄎן⳿׃׾剅ֻ䗳銲ָ֮׷կ %FGFSSBCMFHVBSBOUFFEFYFDVUJPO ך⡦ָ㉏겗ַ ֿ׸ח8PSL.BOBHFSָ㼎䘔ׅ׷
  5. ⢽ִלו׿זةأؙ ˖ ӧخ؎٦ز ˖ ӧًر؍،ؿ؋؎ٕך؟٦غ٦פך،حفٗ٦س ˖ ӧر٦ةךػ٦أהر٦ةك٦أפך⥂㶷 ˖ –ػٖحزؕٓ٦׾䬄⳿׃ג*NBHF7JFX׾،حف ر٦ز

    ˖ –ر٦ة׾ػ٦أ׃ג7JFXך،حفر٦ز ˖ –铬ꆃךزٓٝؠؙءّٝ׾㹋遤 ⳿ⰩIUUQTZPVUVCF*S,P#'-X5/ ^ ˖ 5ISFBE1PPM ˖ 3Y+BWB ˖ ,PUMJO $PSPVUJOF
 ׾⢪ֲ
  6. ⢽ִלו׿זةأؙ ˖ ӧخ؎٦ز ˖ ӧًر؍،ؿ؋؎ٕך؟٦غ٦פך،حفٗ٦س ˖ ӧر٦ةךػ٦أהر٦ةك٦أפך⥂㶷 ˖ –ػٖحزؕٓ٦׾䬄⳿׃ג*NBHF7JFX׾،حف ر٦ز

    ˖ –ر٦ة׾ػ٦أ׃ג7JFXך،حفر٦ز ˖ –铬ꆃךزٓٝؠؙءّٝ׾㹋遤 ⳿ⰩIUUQTZPVUVCF*S,P#'-X5/ ^ ˖ 5ISFBE1PPM ˖ 3Y+BWB ˖ ,PUMJO $PSPVUJOF
 ׾⢪ֲ ˖ 'PSFHSPVOE 4FSWJDF׾⢪ֲ
  7. 8PSLFS׾⢪׏ג׫׷ const val KEY = "key" class AddHelloWorker : Worker()

    { override fun doWork(): WorkerResult { val inputString = inputData.getString(KEY, "") val outputString = "Hello, $inputString" outputData = mapOf(KEY to outputString).toWorkData() return WorkerResult.SUCCESS } }
  8. const val KEY = "key" class AddHelloWorker : Worker() {

    override fun doWork(): WorkerResult { val inputString = inputData.getString(KEY, "") val outputString = "Hello, $inputString" outputData = mapOf(KEY to outputString).toWorkData() return WorkerResult.SUCCESS } } 8PSLFS׾竰䪫׃ג㹋鄲
  9. const val KEY = "key" class AddHelloWorker : Worker() {

    override fun doWork(): WorkerResult { val inputString = inputData.getString(KEY, "") val outputString = "Hello, $inputString" outputData = mapOf(KEY to outputString).toWorkData() return WorkerResult.SUCCESS } } EP8PSL ׾㹋鄲׃ג 㹋ꥷחֿך8PSLד װ׷ֿה׾剅ֻ
  10. const val KEY = "key" class AddHelloWorker : Worker() {

    override fun doWork(): WorkerResult { val inputString = inputData.getString(KEY, "") val outputString = "Hello, $inputString" outputData = mapOf(KEY to outputString).toWorkData() return WorkerResult.SUCCESS } } EP8PSL ך⚥כ CBDLHSPVOEUISFBEד㹋遤ׁ׸׷
  11. const val KEY = "key" class AddHelloWorker : Worker() {

    override fun doWork(): WorkerResult { val inputString = inputData.getString(KEY, "") val outputString = "Hello, $inputString" outputData = mapOf(KEY to outputString).toWorkData() return WorkerResult.SUCCESS } } 䗳銲ח䘔ׄג䒷侧הז׷JOQVU%BUB׾《׸׷ JOQVU%BUBכBOESPJEYXPSL%BUBؙٓأ 䖓鶢
  12. const val KEY = "key" class AddHelloWorker : Worker() {

    override fun doWork(): WorkerResult { val inputString = inputData.getString(KEY, "") val outputString = "Hello, $inputString" outputData = mapOf(KEY to outputString).toWorkData() return WorkerResult.SUCCESS } } XPSLSVOUJNFLUYךUP8PSL%BUB ד BOESPJEYXPSL%BUBؙٓأח㢌䳔
  13. const val KEY = "key" class AddHelloWorker : Worker() {

    override fun doWork(): WorkerResult { val inputString = inputData.getString(KEY, "") val outputString = "Hello, $inputString" outputData = mapOf(KEY to outputString).toWorkData() return WorkerResult.SUCCESS } } PVUQVU%BUBח➿Ⰵׅ׷
  14. const val KEY = "key" class AddHelloWorker : Worker() {

    override fun doWork(): WorkerResult { val inputString = inputData.getString(KEY, "") val outputString = "Hello, $inputString" outputData = mapOf(KEY to outputString).toWorkData() return WorkerResult.SUCCESS } } 8PSL3FTVMU׾鵤ׅ 46$$&44 '"*-63& 3&53: 3&53:׾鵤ׇל׮ֲ♧䏝㹋遤דֹ׷
  15. 8PSLFS׾⢪׏ג׫׷ val workRequest = OneTimeWorkRequestBuilder<AddHelloWorker>() .setInputData(mapOf(KEY to "World").toWorkData()) .build() WorkManager.getInstance().enqueue(workRequest)

    // workΛ؂ࢹ WorkManager.getInstance() .getStatusById(workRequest.id) .observe(this, Observer<WorkStatus?> { workStatus -> workStatus ?: return@Observer when (workStatus.state) { State.SUCCEEDED -> { val outputData: Data = workStatus.outputData val output = outputData.getString(KEY, "default") toast(output) } else -> { } }
  16. val workRequest = OneTimeWorkRequestBuilder<AddHelloWorker>() .setInputData(mapOf(KEY to "World").toWorkData()) .build() WorkManager.getInstance().enqueue(workRequest) //

    workΛ؂ࢹ WorkManager.getInstance() .getStatusById(workRequest.id) .observe(this, Observer<WorkStatus?> { workStatus -> workStatus ?: return@Observer when (workStatus.state) { State.SUCCEEDED -> { val outputData: Data = workStatus.outputData val output = outputData.getString(KEY, "default") toast(output) } else -> { } } 8PSL3FRVFTU׾⡲䧭
  17. val workRequest = OneTimeWorkRequestBuilder<AddHelloWorker>() .setInputData(mapOf(KEY to "World").toWorkData()) .build() WorkManager.getInstance().enqueue(workRequest) //

    workΛ؂ࢹ WorkManager.getInstance() .getStatusById(workRequest.id) .observe(this, Observer<WorkStatus?> { workStatus -> workStatus ?: return@Observer when (workStatus.state) { State.SUCCEEDED -> { val outputData: Data = workStatus.outputData val output = outputData.getString(KEY, "default") toast(output) } else -> { } TFU*OQVU%BUBדر٦ة׾床ׅ
  18. val workRequest = OneTimeWorkRequestBuilder<AddHelloWorker>() .setInputData(mapOf(KEY to "World").toWorkData()) .build() WorkManager.getInstance().enqueue(workRequest) //

    workΛ؂ࢹ WorkManager.getInstance() .getStatusById(workRequest.id) .observe(this, Observer<WorkStatus?> { workStatus -> workStatus ?: return@Observer when (workStatus.state) { State.SUCCEEDED -> { val outputData: Data = workStatus.outputData val output = outputData.getString(KEY, "default") toast(output) } else -> { } FORVFVF ד㹋遤
  19. val workRequest = OneTimeWorkRequestBuilder<AddHelloWorker>() .setInputData(mapOf(KEY to "World").toWorkData()) .build() WorkManager.getInstance().enqueue(workRequest) //

    workΛ؂ࢹ WorkManager.getInstance() .getStatusById(workRequest.id) .observe(this, Observer<WorkStatus?> { workStatus -> workStatus ?: return@Observer when (workStatus.state) { State.SUCCEEDED -> { val outputData: Data = workStatus.outputData val output = outputData.getString(KEY, "default") toast(output) } else -> { } 8PSL.BOBHFSHFU4UBUVT#Z*Eד -JWF%BUB8PSL4UBUVTָ《䖤דֹ׷
  20. val workRequest = OneTimeWorkRequestBuilder<AddHelloWorker>() .setInputData(mapOf(KEY to "World").toWorkData()) .build() WorkManager.getInstance().enqueue(workRequest) //

    workΛ؂ࢹ WorkManager.getInstance() .getStatusById(workRequest.id) .observe(this, Observer<WorkStatus?> { workStatus -> workStatus ?: return@Observer when (workStatus.state) { State.SUCCEEDED -> { val outputData: Data = workStatus.outputData val output = outputData.getString(KEY, "default") toast(output) } else -> { } } JEכ8PSL3FRVFTUַ׵《䖤דֹ׷կ
  21. val workRequest = OneTimeWorkRequestBuilder<AddHelloWorker>() .setInputData(mapOf(KEY to "World").toWorkData()) .build() WorkManager.getInstance().enqueue(workRequest) //

    workΛ؂ࢹ WorkManager.getInstance() .getStatusById(workRequest.id) .observe(this, Observer<WorkStatus?> { workStatus -> workStatus ?: return@Observer when (workStatus.state) { State.SUCCEEDED -> { val outputData: Data = workStatus.outputData val output = outputData.getString(KEY, "default") toast(output) } else -> { } } }) 8PSL4UBUVT4UBUFד朐䡾׾鋅׷ #-0$,&% $"/$&--&% &/26&6&%  '"*-&% 36//*/( 46$$&&%&%ָ֮׷
  22. val workRequest = OneTimeWorkRequestBuilder<AddHelloWorker>() .setInputData(mapOf(KEY to "World").toWorkData()) .build() WorkManager.getInstance().enqueue(workRequest) //

    workΛ؂ࢹ WorkManager.getInstance() .getStatusById(workRequest.id) .observe(this, Observer<WorkStatus?> { workStatus -> workStatus ?: return@Observer when (workStatus.state) { State.SUCCEEDED -> { val outputData: Data = workStatus.outputData val output = outputData.getString(KEY, "default") toast(output) } else -> { } } }) XPSL4UBUVTַ׵PVUQVU׃׋%BUBؙٓأח ،ؙإأדֹ׷
  23. 8PSL.BOBHFSך堣腉稱➜ ˖ 8PSLך⣛㶷ؚٓؿָ⡲׸׷ ˖ UIFO ד8PSL׾籬־׵׸׷ ˖ 3Y+BWBך[JQ׫׋ְזֿהָדֹ׷ ˖ *OQVU.FSHFS׾⢪ֲ

    ˖ 8PSLח勴⟝׾אֽ׵׸׷ ˖ -JWF%BUBד➙ך朐䡾ָ鋅׵׸׷ ˖ 8PSLחةؚ׾אֽג穾׶鴥׫זוָדֹ׷ ˖ ثؑ؎ٝꟚ㨣儗חِص٦ؙזせ⵸׾אֽג穾׶鴥׫װծ
 ずׄせ⵸ָ崧׸׋הֹךⵖ䖴ָדֹ׷
  24. UIFO ד8PSL׾籬־׵׸׷ ˖ ⱖ溪ךؿ؍ٕة٦׾ַֽ׋䖓،حفٗ٦س׃׋ְהֹזוחⵃ欽ׅ׷ ˖ ➙㔐כ8PSME)FMMP 8PSME)&--0 803-%׾װ׏ג׫׋ WorkManager.getInstance() .beginWith(

    OneTimeWorkRequestBuilder<AddHelloWorker>() .setInputData( mapOf( KEY to "World" ).toWorkData() ) .build() ) .then(OneTimeWorkRequestBuilder<UpperCaseWorker>().build()) .enqueue()
  25. 8PSL.BOBHFSך堣腉稱➜ ˖ 8PSLך⣛㶷ؚٓؿָ⡲׸׷ ˖ UIFO ד8PSL׾籬־׵׸׷ ˖ 3Y+BWBך[JQ׫׋ְזֿהָדֹ׷ ˖ *OQVU.FSHFS׾⢪ֲ

    ˖ 8PSLח勴⟝׾אֽ׵׸׷ ˖ -JWF%BUBד➙ך朐䡾ָ鋅׵׸׷ ˖ 8PSLחةؚ׾אֽג穾׶鴥׫זוָדֹ׷ ˖ ثؑ؎ٝꟚ㨣儗חِص٦ؙזせ⵸׾אֽג穾׶鴥׫װծ
 ずׄせ⵸ָ崧׸׋הֹךⵖ䖴ָדֹ׷
  26. 8PSLח勴⟝׾אֽ׵׸׷ val workRequest = OneTimeWorkRequestBuilder<AddHelloWorker>() .setInputData(mapOf(KEY to "World").toWorkData()) .setConstraints(Constraints.Builder().setRequiresCharging(true).build()) .build()

    TFU$POTUSBJOUד鏣㹀׃ג֮־׷ ⯍ꨵָ㨣ת׷הծ㹋遤ׁ׸׷ ˖ طحزٙ٦ؙחאזָ׏גְ׷儗ך׫ծ
 ⯍ꨵ儗ך׫㹋遤זוך♳ꣲָאֽ׵׸׷
  27. 8PSL.BOBHFSך堣腉稱➜ ˖ 8PSLך⣛㶷ؚٓؿָ⡲׸׷ ˖ UIFO ד8PSL׾籬־׵׸׷ ˖ 3Y+BWBך[JQ׫׋ְזֿהָדֹ׷ ˖ *OQVU.FSHFS׾⢪ֲ

    ˖ 8PSLח勴⟝׾אֽ׵׸׷ ˖ -JWF%BUBד➙ך朐䡾ָ鋅׵׸׷ ˖ 8PSLחةؚ׾אֽג穾׶鴥׫זוָדֹ׷ ˖ ثؑ؎ٝꟚ㨣儗חِص٦ؙזせ⵸׾אֽג穾׶鴥׫װծ
 ずׄせ⵸ָ崧׸׋הֹךⵖ䖴ָדֹ׷
  28. 8PSLחةؚ׾אֽג穾׶鴥׫זו ָדֹ׷ val taggedRequest = OneTimeWorkRequestBuilder<AddHelloWorker>() .setInputData(mapOf(KEY to "WorkManager").toWorkData()) .addTag("tag")

    .build() WorkManager.getInstance().enqueue(taggedRequest) WorkManager.getInstance() .getStatusesByTag("tag") .observe(this, Observer<List<WorkStatus>> { workStatuses -> val workStatus = workStatuses?.getOrNull(0) ?: return@Observer when (workStatus.state) { State.SUCCEEDED -> { BEE5BHדةؚ鷄⸇ ˖ 㥨ֹחط٦يأل٦أ׾⡲׸׷
  29. 8PSLחةؚ׾אֽג穾׶鴥׫זו ָדֹ׷ val taggedRequest = OneTimeWorkRequestBuilder<AddHelloWorker>() .setInputData(mapOf(KEY to "WorkManager").toWorkData()) .addTag("tag")

    .build() WorkManager.getInstance().enqueue(taggedRequest) WorkManager.getInstance() .getStatusesByTag("tag") .observe(this, Observer<List<WorkStatus>> { workStatuses -> val workStatus = workStatuses?.getOrNull(0) ?: return@Observer when (workStatus.state) { State.SUCCEEDED -> { HFU4UBUVTFT#Z5BHד穾׶鴥׫ ˖ ➭ח׮ةؚ⽃⡘דٍؗٝإٕ׃׋׶⳿勻׷
  30. 8PSL.BOBHFSך堣腉稱➜ ˖ 8PSLך⣛㶷ؚٓؿָ⡲׸׷ ˖ UIFO ד8PSL׾籬־׵׸׷ ˖ 3Y+BWBך[JQ׫׋ְזֿהָדֹ׷ ˖ *OQVU.FSHFS׾⢪ֲ

    ˖ 8PSLח勴⟝׾אֽ׵׸׷ ˖ -JWF%BUBד➙ך朐䡾ָ鋅׵׸׷ ˖ 8PSLחةؚ׾אֽג穾׶鴥׫זוָדֹ׷ ˖ ثؑ؎ٝꟚ㨣儗חِص٦ؙזせ⵸׾אֽג穾׶鴥׫װծ
 ずׄせ⵸ָ崧׸׋הֹךⵖ䖴ָדֹ׷
  31. ثؑ؎ٝꟚ㨣儗חِص٦ؙזせ⵸׾אֽג 穾׶鴥׫װծⵖ䖴ָדֹ׷ val workRequest = OneTimeWorkRequestBuilder<AddHelloWorker>() .setInputData(mapOf(KEY to "World").toWorkData()) .build()

    WorkManager.getInstance() .beginUniqueWork("hello", ExistingWorkPolicy.KEEP, workRequest ).enqueue() ずׄせ⵸ד8PSL׾㨣׭׋儗ךهٔء٦ ˖ ,&&1⯓ח㨣׭׋8PSL׌ֽ㹋遤 ˖ 3&1-"$&⯓ח㨣׭׋8PSL׾ٍؗٝإٕ׃ג⵴ꤐծ倜׃ְ8PSL׾Ꟛ㨣 ˖ "11&/%⯓ח㨣׭׋8PSLך䖓חծ⚕倯遤ֲկ
  32. 8PSL.BOBHFSך⣛㶷ꟼ⤘ BOESPJEBSDIXPSLXPSLSVOUJNFBMQIB ] BOESPJEBSDIMJGFDZDMFFYUFOTJPOT ]] BOESPJEBSDIMJGFDZDMFSVOUJNF  ]] BOESPJEBSDIDPSFDPNNPO 

    ]] BOESPJEBSDIDPSFSVOUJNF  ]] DPNBOESPJETVQQPSUTVQQPSUGSBHNFOU  ]] BOESPJEBSDIMJGFDZDMFDPNNPO  ]] BOESPJEBSDIMJGFDZDMFMJWFEBUB ]]] BOESPJEBSDIDPSFSVOUJNF  ]]] BOESPJEBSDIMJGFDZDMFMJWFEBUBDPSF  ]]]=BOESPJEBSDIDPSFDPNNPO  ]]=BOESPJEBSDIMJGFDZDMFWJFXNPEFM  ]=BOESPJEBSDIQFSTJTUFODFSPPNSVOUJNF ] BOESPJEBSDIQFSTJTUFODFSPPNDPNNPO ]]=DPNBOESPJETVQQPSUTVQQPSUBOOPUBUJPOT ] BOESPJEBSDIQFSTJTUFODFECGSBNFXPSL ]] DPNBOESPJETVQQPSUTVQQPSUBOOPUBUJPOT ]]=BOESPJEBSDIQFSTJTUFODFEC ]]=DPNBOESPJETVQQPSUTVQQPSUBOOPUBUJPOT ] BOESPJEBSDIQFSTJTUFODFEC  ] BOESPJEBSDIDPSFSVOUJNF  ]=DPNBOESPJETVQQPSUTVQQPSUDPSFVUJMT ̒-JWF%BUB ̒7JFX.PEFM ̒3PPN 3PPNח⣛㶷׃גְ׷
  33. &YFDVUPSװ+PC4DIFEVMFSזוך
 鼅䫛ٗآحؙ public @NonNull List<Scheduler> getSchedulers() { // Initialized at

    construction time. So no need to synchronize. if (mSchedulers == null) { mSchedulers = Arrays.asList( Schedulers.createBestAvailableBackgroundScheduler(mContext), new GreedyScheduler(mContext, this)); } return mSchedulers; } ˖ (SFFEZ4DIFEVMFSה DSFBUF#FTU"WBJMBCMF#BDLHSPVOE4DIFEVMFS׾⢪ֲ ˖ (SFFEZ4DIFEVMFS  ˖ DSFBUF#FTU"WBJMBCMF#BDLHSPVOE4DIFEVMFS ˖ ⡦ד㹋遤ׅ׷ַ鼅䫛ׅ׷ًاحس
  34. &YFDVUPSװ+PC4DIFEVMFSזוך
 鼅䫛ٗآحؙ public @NonNull List<Scheduler> getSchedulers() { // Initialized at

    construction time. So no need to synchronize. if (mSchedulers == null) { mSchedulers = Arrays.asList( Schedulers.createBestAvailableBackgroundScheduler(mContext), new GreedyScheduler(mContext, this)); } return mSchedulers; } ˖ (SFFEZ4DIFEVMFSה DSFBUF#FTU"WBJMBCMF#BDLHSPVOE4DIFEVMFS ׾⢪ֲ ˖ (SFFEZ4DIFEVMFS  ˖ DSFBUF#FTU"WBJMBCMF#BDLHSPVOE4DIFEVMFS ˖ ⡦ד㹋遤ׅ׷ַ鼅䫛ׅ׷ًاحس
  35. &YFDVUPSװ+PC4DIFEVMFSזוך
 鼅䫛ٗآحؙ public @NonNull List<Scheduler> getSchedulers() { // Initialized at

    construction time. So no need to synchronize. if (mSchedulers == null) { mSchedulers = Arrays.asList( Schedulers.createBestAvailableBackgroundScheduler(mContext), new GreedyScheduler(mContext, this)); } return mSchedulers; } ˖ (SFFEZ4DIFEVMFSה DSFBUF#FTU"WBJMBCMF#BDLHSPVOE4DIFEVMFS׾⢪ֲ ˖ (SFFEZ4DIFEVMFS  ˖ DSFBUF#FTU"WBJMBCMF#BDLHSPVOE4DIFEVMFS
  36. &YFDVUPSװ+PC4DIFEVMFSזוך
 鼅䫛ٗآحؙ public @NonNull List<Scheduler> getSchedulers() { // Initialized at

    construction time. So no need to synchronize. if (mSchedulers == null) { mSchedulers = Arrays.asList( Schedulers.createBestAvailableBackgroundScheduler(mContext), new GreedyScheduler(mContext, this)); } return mSchedulers; } ˖ (SFFEZ4DIFEVMFSה DSFBUF#FTU"WBJMBCMF#BDLHSPVOE4DIFEVMFS׾⢪ֲ ˖ (SFFEZ4DIFEVMFS  ˖ DSFBUF#FTU"WBJMBCMF#BDLHSPVOE4DIFEVMFS
  37. DSFBUF#FTU"WBJMBCMF#BDLHSPVOE
 4DIFEVMFS static @NonNull Scheduler createBestAvailableBackgroundScheduler(@NonNull Context context) { Scheduler

    scheduler; boolean enableFirebaseJobService = false; boolean enableSystemAlarmService = false; if (Build.VERSION.SDK_INT >= WorkManagerImpl.MIN_JOB_SCHEDULER_API_LEVEL) { scheduler = new SystemJobScheduler(context); setComponentEnabled(context, SystemJobService.class, true); Log.d(TAG, "Created SystemJobScheduler and enabled SystemJobService"); } else { try { scheduler = tryCreateFirebaseJobScheduler(context); enableFirebaseJobService = true;
  38. static @NonNull Scheduler createBestAvailableBackgroundScheduler(@NonNull Context context) { Scheduler scheduler; boolean

    enableFirebaseJobService = false; boolean enableSystemAlarmService = false; if (Build.VERSION.SDK_INT >= WorkManagerImpl.MIN_JOB_SCHEDULER_API_LEVEL) { scheduler = new SystemJobScheduler(context); setComponentEnabled(context, SystemJobService.class, true); Log.d(TAG, "Created SystemJobScheduler and enabled SystemJobService"); } else { try { scheduler = tryCreateFirebaseJobScheduler(context); enableFirebaseJobService = true; Log.d(TAG, "Created FirebaseJobScheduler"); } catch (Exception e) { // Also catches the exception thrown if Play Services was not found on the device. scheduler = new SystemAlarmScheduler(context); "1*-FWFM⟃♳ד֮׸לծ 4ZTUFN+PC4DIFEVMFS׾⢪ֲ
  39. boolean enableSystemAlarmService = false; if (Build.VERSION.SDK_INT >= WorkManagerImpl.MIN_JOB_SCHEDULER_API_LEVEL) { scheduler

    = new SystemJobScheduler(context); setComponentEnabled(context, SystemJobService.class, true); Log.d(TAG, "Created SystemJobScheduler and enabled SystemJobService"); } else { try { scheduler = tryCreateFirebaseJobScheduler(context); enableFirebaseJobService = true; Log.d(TAG, "Created FirebaseJobScheduler"); } catch (Exception e) { // Also catches the exception thrown if Play Services was not found on the device. scheduler = new SystemAlarmScheduler(context); enableSystemAlarmService = true; Log.d(TAG, "Created SystemAlarmScheduler"); } } "1*-FWFM劢弫ד֮׸לծ 'JSFCBTF+PC4DIFEVMFS׾ 鑐ׅ
  40. Log.d(TAG, "Created SystemJobScheduler and enabled SystemJobService"); } else { try

    { scheduler = tryCreateFirebaseJobScheduler(context); enableFirebaseJobService = true; Log.d(TAG, "Created FirebaseJobScheduler"); } catch (Exception e) { // Also catches the exception thrown if Play Services was not found on the device. scheduler = new SystemAlarmScheduler(context); enableSystemAlarmService = true; Log.d(TAG, "Created SystemAlarmScheduler"); } } ׉׸ד׮تًד֮׸ל "MBSN.BOBHFS׾⢪ֲ
  41. DSFBUF#FTU"WBJMBCMF#BDLHSPVOE
 4DIFEVMFS static @NonNull Scheduler createBestAvailableBackgroundScheduler(@NonNull Context context) { Scheduler

    scheduler; boolean enableFirebaseJobService = false; boolean enableSystemAlarmService = false; if (Build.VERSION.SDK_INT >= WorkManagerImpl.MIN_JOB_SCHEDULER_API_LEVEL) { scheduler = new SystemJobScheduler(context); setComponentEnabled(context, SystemJobService.class, true); Log.d(TAG, "Created SystemJobScheduler and enabled SystemJobService"); } else { try { scheduler = tryCreateFirebaseJobScheduler(context); enableFirebaseJobService = true; DSFBUF#FTU"WBJMBCMF#BDLHSPVOE
 4DIFEVMFS דכせ⵸ך鸐׶ ⢪ִ׷♧殢ְְ4DIFEVMFS׾鵤ׅ
  42. 8PSL.BOBHFSךذأز @Test fun test() { val testDriver = WorkManagerTestInitHelper.getTestDriver() val

    workRequest = OneTimeWorkRequestBuilder<AddHelloWorker>() .setInputData(mapOf(KEY to "World").toWorkData()) .build() WorkManager.getInstance() .enqueue(workRequest) testDriver.setAllConstraintsMet(workRequest.id) val outputData = WorkManager.getInstance().synchronous().getStatusByIdSync(workRequest.id).out putData assertThat(outputData.getString(KEY, "none"), equalTo("Hello, World")) } 5FTU%SJWFS ׾⢪׏גず劍涸ח⹛ַ׃גذأزדֹ׷
  43. كأزفؙٓذ؍أ ˖ ءأذيָ،فָٔ穄✪׃׋ה׃ג׮ծ⹛⡲⥂鏾׃׋ְ ةأؙך׋׭ח⢪ֲկ ˖ %BUBؙٓأכر٦ةأز،דכזְךד3PPNזו׾⢪ֲ ˖ 㹋遤דֹ׷堣⠓׾ֲֲַָ״ֲח$POTUSBJOUד勴⟝׾剅ֿ ֲկ
 ⢽ִל歗⫷ך⸇䊨ה،حفٗ٦س׾ׅ׷儗ח،حفٗ٦

    سך8PSLחطحزٙ٦ָؙ䗳銲׌ה׃גֶֽלծ
 굲遤堣ח⛦׏גְ׷꟦ח歗⫷ך⸇䊨תדכ穄׻׏גծ籬 ָ׏׋׵،حفٗ٦س׃גֻ׸׷זוָדֹ׷ ⳿ⰩIUUQTZPVUVCF*S,P#'-X5/
  44. ⿫罋项俱 ˖ IUUQTEFWFMPQFSBOESPJEDPNUPQJDMJCSBSJFTBSDIJUFDUVSF XPSLNBOBHFS ˖ IUUQTXXXZPVUVCFDPNXBUDI W*S,P#'-X5/ ˖ IUUQTXXXZPVUVCFDPNXBUDI WQ&S5Z2Q"

    ˖ IUUQTDPEFMBCTEFWFMPQFSTHPPHMFDPNDPEFMBCTBOESPJE XPSLNBOBHFS ˖ IUUQTHJUIVCDPNHPPHMFTBNQMFTBOESPJEBSDIJUFDUVSF DPNQPOFOUTUSFFNBTUFS8PSL.BOBHFS4BNQMF