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

Background Execution LimitsのAndroid Pの変更点?

Background Execution LimitsのAndroid Pの変更点?

B6721fa2b0c10af071878ad23d190291?s=128

Victor Lee

July 26, 2018
Tweet

Transcript

  1. #BDLHSPVOE&YFDVUJPO-JNJUTͷ "OESPJE1ͷมߋ఺ʁ 4IJOKVLVBBS !LPOZBWJD

  2. !LPOZBWJD ཥঝӹʢΓͪ͐Μ͍ʣɾ୆࿷ग़਎ɾ೔ຊ೥໨ ࡶ৯ܥΤϯδχΞ d૊ࠐΈ04ݚڀ⾣dήʔϜ։ൃ⾣d4%,։ൃ

  3. ಥવͰ͕͢

  4. ࢲͷ஀ੜ೔͸݄Ͱ͢

  5. ͦͯ͠

  6. ࠓ೥ͷ݄͸ಛผͰ͢

  7. ‣ 5BSHFU"1*MFWFM SFRVJSFNFOUGSPNMBUF  ‣ /PWFNCFS 6QEBUFTUPFYJTUJOH BQQTSFRVJSFEUP UBSHFU"1*MFWFMPS IJHIFS

  8. Έͳ͞Μɺ४උͰ͖ͯ·͢ʁ

  9. #BDLHSPVOE4FSWJDF-JNJUBUJPOT

  10. #BDLHSPVOE4FSWJDF-JNJUBUJPOT ‣ ؆୯ʹݴ͏ͱ ‣ GPSFHSPVOETFSWJDF͡Όͳ͍ͱBQQCBDLHSPVOEͰTFSWJDFΛىಈͰ ͖ͳ͍ ‣ 3FQSP4%,͸BQQGPSFHSPVOEͰ͔͠TFSWJDFΛىಈ͠ͳ͍ͷͰେৎ෉ ‣ "OESPJE1ͷมߋ఺͸ʁ

    Background Execution Limits - https://developer.android.com/about/versions/oreo/background
  11. ಛʹมߋ఺ͳ͠

  12. ͕ɺ

  13. ݄ࠒʹɺಥવͷΫϥογϡϨϙʔτ͕ಧ͘ ‣ ʮ3FQSP4%,ͷTFSWJDF͕ىಈͰ͖ͳ͍ʯ ‣ ʮΞϓϦ͸όοΫάϥ΢ϯυʹ͋Δʯ ‣ ͔͠͠ɺ͜ͷTFSWJDF͸PO3FTVNFͷͱ͖ʹىಈ͍ͯ͠Δ ‣ ͜ͷλΠϛϯάʹΞϓϦ͕όοΫάϥ΢ϯυʹ͍Δ͜ͱ͸ɺ͋Γ͑Δͷ ͔ʜʁ

    ‣ "OESPJE1ͷFNV࣮ػͷͲͪΒͰ΋࠶ݱ͠ͳ͍ʜ ‣ ௐࠪ͸೉ߤͨ͠ʜ java.lang.RuntimeException: Unable to resume activity {*****/*****.MainActivity}: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=*****/ io.repro.android.ReproService }: app is in background uid UidRecord{3d93b8d u0a308 TPSL bg:+2m19s542ms idle change:cached procs:1 seq(0,0,0)}
  14. ͻΒΊ͖

  15. ͻΒΊ͖ͦͷ̍ ‣ 1ݶఆͷܗ੻ android.app.ActivityThread.performResumeActivity(ActivityThread.java:3773) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3805) at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecut

    or.java:145) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1797) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6642) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java: 493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
  16. ͻΒΊ͖ͦͷ̍ ‣ 1ݶఆͷܗ੻ android.app.ActivityThread.performResumeActivity(ActivityThread.java:3773) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3805) at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecut

    or.java:145) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1797) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6642) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java: 493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) Android O·Ͱͳ͔ͬͨ
  17. ͻΒΊ͖ͦͷ̎ ‣ JEMFNPEFݶఆ java.lang.RuntimeException: Unable to resume activity {*****/*****.MainActivity}: java.lang.IllegalStateException:

    Not allowed to start service Intent { cmp=*****/ io.repro.android.ReproService }: app is in background uid UidRecord{3d93b8d u0a308 TPSL bg:+2m19s542ms idle change:cached procs:1 seq(0,0,0)} Optimize for Doze and App Standby - https://developer.android.com/training/monitoring-device- state/doze-standby What is idle mode in Android - https://stackoverflow.com/questions/11310871/what-is-idle- mode-in-android
  18. ͻΒΊ͖ͦͷ̎ ‣ JEMFNPEFݶఆ java.lang.RuntimeException: Unable to resume activity {*****/*****.MainActivity}: java.lang.IllegalStateException:

    Not allowed to start service Intent { cmp=*****/ io.repro.android.ReproService }: app is in background uid UidRecord{3d93b8d u0a308 TPSL bg:+2m19s542ms idle change:cached procs:1 seq(0,0,0)} Screen OFFͰ࠶ݱʂ
  19. ͭ·Γ ‣ 4DSFFO0''ͷঢ়ଶͰΞϓϦΛ্ཱͪ͛Δͱ͖ͷPO3FTVNFͰTFSWJDF Λىಈ͠Α͏ͱ͍ͯͯ͠ɺͦΕ͕#BDLHSPVOE4FSWJDF-JNJUTʹҾͬ ͔͔ͬͨ ‣ "MBSN.BOBHFSͰΞϓϦΛىಈͤ͞Δ৔߹͕͋Ε͹ൃੜ͠͏Δ ‣ 4DSFFO0''ͷ··"OESPJE4UVEJP΍BNίϚϯυܦ༝ͰΞϓϦىಈ ͢Ε͹ಉ͡ڍಈΛ࠶ݱͰ͖Δ

    ‣ "OESPJE1 QSFWJFX ͰΫϥογϡ͕࠶ݱ͢Δɺ
 "OESPJEͰΫϥογϡ͕࠶ݱ͠ͳ͍
 "OESPJE͸෼͔Βͳ͍
  20. "OESPJE4%,ͷࠩ෼Λ୳ͦ͏ʂ

  21. ྗਚ͖ͨʜ

  22. ࠩ෼͕ݟ͔ͭΒͳ͍ʜ ‣ "OESPJE0͔ΒͷόοΫάϥ΢ϯυɾ αʔϏεͷ੍ݶࣄ߲Λ࣮ԋ͢Δɻ IUUQTRJJUBDPNOVLLBJUFNT CDGFF ‣ ͔͠͠ɺͪ͜Βͷهࣄʹग़͍ͯΔൣғ Ͱɺ"OESPJE1ͷ࠷৽ͷιʔεΛ୳͠ ճͬͯ΋ࠓճͷڍಈʹؔ࿈ͦ͠͏ͳࠩ

    ෼͕ͳ͔ͬͨ
  23. ΞϓϦͷJEMFNPEF͸ɺ
 Ͳ͏΍ͬͯݕग़Ͱ͖Δͷʁ