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

いまからはじめるAndroid 6.0対応

Ad37f739bffa0e38c8461e452cb3a489?s=47 yamacraft
March 10, 2017

いまからはじめるAndroid 6.0対応

2017/03/10 Droidkaigi2017 Day2 12:40- room4
にて発表した「いまからはじめるAndroid 6.0対応 〜Android 7.0から8.xを見つめて〜」の資料です。

Ad37f739bffa0e38c8461e452cb3a489?s=128

yamacraft

March 10, 2017
Tweet

Transcript

  1. ͍·͔Β͸͡ΊΔ Android 6.0ରԠ @yamacraft

  2. profile • @yamacraft (Wataru Yamada) • Mobile Application Engineer •

    LeadingMark, inc • team Y.G.E.(private)
  3. Works (LeadingMark, Inc)

  4. book • 4݄11೔ൃച • Android 7.0/7.1 • Firebase (Android/iOS) •

    Analytics • Notifications
  5. Android 7.0(7.1)ͷ࿩͸ ͠·ͤΜʂ

  6. ͳ͍ͥ·6.0ରԠͷ࿩ʁ

  7. ڈ೥ͷτʔΫωλͰͨ͠

  8. ʲࠓճͷఆٛʳ targetSdkVersion͕23Ҏ্ ʹͳ͍ͬͯΔ = 6.0ରԠ

  9. ରԠऴΘͬͯͳ͍ΞϓϦɺ͋Δ ΑͶʁ ˞ZBNBDSBGU୺຤ௐ΂

  10. ࠓճ఻͍͑ͨ͜ͱ • 6.0ରԠʢtargetSdkVersion=23ରԠʣͷ࿩ • ٕज़తͳ࿩ʗࢥ૝తͳʢΤϞ͍ʣ࿩ • ৽͍͠APIόʔδϣϯ΁ͷରԠ΍ௐࠪΛ͢Δ ͱ͖ͷϊ΢ϋ΢ͷڞ༗ • ͨͿΜ࣍ʢAndroid

    Oʁʣ͸͜Ε͕ةͳͦ͏ʂ
  11. Android6.0ରԠͷ࿩

  12. 6.0ରԠͬͯඞཁʁ

  13. ୺຤ͷOSγΣΞ No.1※ ʢ2017/03࣌఺ ໿30%ʣ

  14. Dashboard/Platform Versions • ࠃ಺Ͱ΋͍͍ͩͨ͜Μͳײ͡

  15. ࠃ಺Ͱൃചͯ͠Δ୺຤͸ ΋͏6.0Ҏ্͕ඪ४

  16. ࠃ಺ΩϟϦΞͷ୺຤ঢ়گ

  17. ଞʹ΋6.0ରԠ͢΂͖ཧ༝ • ௨৴ܥͰେ͖ͳมߋʢ࡟আʣ͕͋Δ • UIʹେ͖͘Өڹ͢Δػೳ௥Ճ ʢRuntimePermissionʣ͕͋Δ • ҙຯ͕͋Δ͔Β͜͏ͳ͍ͬͯΔ • Ϣʔβʔ΁ͷ৽͍͠OSͷՁ஋ΛఏڙΛ્֐͍ͯ͠Δ

  18. ΞϓϦ͸ ϦϦʔε͢Δ͚ͩ͡Όͳ͍

  19. ΞϓϦ͸ੜ͖͍ͯΔ

  20. ΞϓϦ͸͖ͪΜͱҭͯΑ͏ʂ

  21. 6.0ରԠͰ΍ͬͨ͜ͱ

  22. ௨৴ܥͷେ͖ͳมߋ

  23. Apache HTTP Clientͷ࡟আ

  24. Apache HTTP Clientͷ࡟আ

  25. Apache HTTP Clientͷ࡟আ • Apacheύοέʔδ·Δ͝ͱ࡟আ • ࢒͍ͬͯΔͷ͸࣮࣭ఆ਺ͷΈ • ௨৴पΓʹଟେͳӨڹ •

    ౰࣌ɺ௨৴͸VolleyΛ࢖͍ͬͯͨ • Volley͸Apache HTTP Clientʹґଘ
  26. Volley͔Βͷ୤٫

  27. ༨ஊ

  28. google/volley • ڈ೥຤ʹGitHubʹϦϙδτϦ্͕͕͍ͬͯͨ • ͔͠΋ϝϯςφϯε͞Ε͍ͯΔʁ

  29. org.apache.http.legacy

  30. org.apache.http.legacyʁ • ެ͕ࣜ༻ҙͯ͘͠ΕͨʮͲ͏ͯ͠΋Apache HTTP Client͕࢖͍͍ͨ։ൃऀʯͷͨΊʹ༻ҙ ͯ͘͠Εͨղܾࡦ • https://developer.android.com/about/ versions/marshmallow/android-6.0- changes.html?#behavior-apache-http-client

  31. ʮղܾࡦʯͰ͋ͬͯ ʮରԠʯ͔ͳ͋ʁ

  32. ༨ஊऴΘΓ

  33. Volley͔Βͷ୤٫

  34. OkHttp࢖͓͏ʂ

  35. OkHttp / Retrofit΁ͷҠߦ • ͲͪΒ΋ squareࣾఏڙͷϥΠϒϥϦ • OkHttp͸௨৴શൠʗRetrofit͸API௨৴ʹಛԽ • Apache

    HTTP ClientΛར༻͍ͯ͠ͳ͍ • ࠓ΋ੲ΋ϝϯςφϯε͕͞Ε͍ͯΔ • Retrofit͕OkHttpʹґଘ͍ͯ͠Δ఺͸஫ҙ
  36. Ҡߦɺେมʁ

  37. ಛʹ໰୊ͳ͘ҠߦͰ͖ͨ • ಉظʗඇಉظॲཧɺύʔαʔʢGson౳ʣͷର Ԡ • ඇಉظͷฦ٫ํ๏΋جຊಉ͡ • ੒ޭͨ͠ΒonResponse() • ࣦഊͨ͠ΒonFailure()

  38. ௨৴ॲཧʹґଘ͠ͳ͍ ViewͱClientΛ࡞͓ͬͯ͘

  39. ผʹΩϨΠͳMVPͰ΋MVVM Ͱͳͯ͘΋͍͍

  40. apacheΛ࢖ͬͨಛघέʔε

  41. apacheΛ࢖ͬͨಛघέʔε • ΞϓϦ಺ͰαʔόΛݐͯΔॲཧΛ࣮૷͍ͯͨ͠ • ౰વ6.0Ͱ֘౰ॲཧ͕׬શʹࢮ๢ • ετϦʔϛϯά෦෼Λഇͯ͠ɺී௨ʹϝσΟΞ ϓϨΠϠʔͰ࠶ੜ • ݩʑ͋ͬͨ୺຤ґଘ໰୊΋͋Θͤͯղফ͞Εͨ

  42. Ή͔͍ͣ͠࢖͍ํ͸ ΍ΊΑ͏ʂ

  43. RuntimePermissionͷ ରԠ

  44. ͜Ε

  45. RuntimePermission • ಛఆͷύʔϛογϣϯ͸ϢʔβʔڐՄΛ΋Β ͏ඞཁ͕Ͱ͖ͨ • targetSdkVersion=23ʹ͢Δͱɺؔ࿈ͷύʔ ϛογϣϯ͸શͯʮσϑΥϧτͰOFFʯ͞Ε Δ • ͍͓ͪ͏ɺ୺຤ઃఆ͔ΒڐՄͷ੾ସ͕Մೳ

  46. ରԠ͠ͳͪ͘Όʂ

  47. None
  48. …͸ɺ౰࣌ͳ͔ͬͨ ͷͰ௨ৗ࣮૷͠·ͨ͠

  49. None
  50. ௨ৗ࣮૷΋͍͍ͧ • ࠓޙ΋ύʔϛογϣϯ͕มԽ͠ͳ͍ͱݶΒͳ͍ • ಺༰ࣗମ͸γϯϓϧͳͷͰɺҰ౓͸ࣗલͰ࣮૷ ͓͍ͯͨ͠ํ͕͍͍ • ݩͷॲཧΛ஌Βͳ͍͜ͱ͸͔ͳΓةݥ • ʮڋ൱ʯ͞Εͨ࣌ͷ͜ͱΛ๨Ε͕ͪ

  51. RuntimePermission͸UX • Ϣʔβʔʹʮ҆৺ײʯΛఏڙ͢ΔͨΊͷUI • ཧղͰ͖ͯೲಘͰ͖ΔλΠϛϯάͰग़ͤ͹Ϣʔβʔ ͸ڋઈ͠ͳ͍ʢྫ֎͋Γʣ • ։ൃऀ౎߹͚ͩͰཉ͍͠ύʔϛογϣϯ͕ڋઈ͞ ΕΔͷ͸౰વͩΑͶ •

    ͜ΕΛػʹʮ͋Δ΂͖UIʯΛݟ௚ͦ͏
  52. Ͱ΋͜Ε

  53. ΤϯδχΞ͚ͩͰ ܾΊΒΕͳ͍ΑͶʁ

  54. YES

  55. Ͱ΋ʮඞཁʯͰ͋Δͱ ఻͑Δ͜ͱ͸Ͱ͖Δ

  56. େࣄͳ͜ͱ • ϓϩσϡʔαʔɺσβΠφʔɺΤϯδχΞͰ ͦΕͧΕʮ஌Δ΂͖஌ࣝʯ͸ҟͳΔΑͶ • ۩ମతͳAPIͷ࢓༷͸ʮΤϯδχΞ͕஌Δ΂͖ ஌ࣝʯͩΑͶ • ஌Δ΂͖஌ࣝΛڞ༗͋ͬͯ͠ఏҊ͋͠͏ͷ͕ ʮνʔϜʯͩΑͶ

  57. େࣄͳ͜ͱ͸ Ωνϯͱ఻͑Α͏

  58. ఻͑ͯ΋μϝͩͬͨʁ

  59. None
  60. ͓͠·͍ʁ

  61. ࠓޙ͋Ϳͳͦ͏ͳAPI

  62. ʲGoogle͕ؾʹͯ͠Δ͜ͱʳ અిʢ௨৴ؚΉʣ লϝϞϦ ηΩϡϦςΟ

  63. ͳʹΑΓ javaඪ४API ≒Google͕؅ཧͰ͖ͳ͍API ͕ා͍

  64. ҉߸Խશൠ

  65. ͓͠·͍