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

Prepare for Android 8.0/GDG-Kobe 2017-09-18

jsugai
October 04, 2017

Prepare for Android 8.0/GDG-Kobe 2017-09-18

jsugai

October 04, 2017
Tweet

More Decks by jsugai

Other Decks in Research

Transcript

  1. "Coming hand-in-hand with the Android Oreo release is a female

    superhero (think: green Android mascot with a belly made from an Oreo), which the brands say is meant to mix the "playfulness" of Oreo and the "intelligence" of Android."
  2. ϙΠϯτ 1.API ΍ OS ͷ࢓༷͕มߋ or ௥Ճ͞Εͯڍಈ͕มΘΔ 2. ར༻͍ͯ͠Δ OSS

    ʹΑͬͯؒ઀తʹ 1 ͷӨڹΛड͚Δ 3. ৽͍͠όʔδϣϯͷ Support Lib ͳͲͰͷόά 4. Gradleͷઃఆ Λ API Level26 ʹͯ͠ݕূ͢Δ
  3. ಈ࡞ݕূ 1. Android 8.0 ୺຤Ͱ app ͷಈ࡞ݕূ͢Δ 2. Gradleͷ֤छઃఆ ΛAPI

    Level26 ʹ֤ͯ͠OSͰݕূ͢Δ ɾ compileSdkVersion 26 ɾ buildToolsVersion '26.0.x' ɾ targetSdkVersion 26
  4. "ଞͷΞϓϦʹॏͶͯදࣔ" Android 4.0~5.x / API Level 14~22 ɾ<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

    ɾWindowManager ʹ addView Android 6.0~7.x / API Level 23~25 ɾࠓ·Ͱͷʹ + RuntimePermission ʹରԠ Android 8.0~ / API Level 26 ɾࠓ·Ͱͷʹ + WindowManager ʹ addView ͢Δͱ͖ͷ LayerType Λ WindowManager.LayoutParams.TYPE_SYSTEM_ALERT ͔Β
 WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY ʹมߋ͢Δඞཁ͕͋Δ
  5. VectorDrawable Gradle - vectorDrawables.useSupportLibrary = true XML - app:srcCompat="@drawable/xxxx" Ͱࢦఆ͢Δ

    - TextView ͷ CompoundDrawable ͸ StateListDrawable ͷதͰఆٛ ※ίʔυͰࢦఆ͢Δͱ͖΋ಉ͡Ͱ ImageView ͳͲͱ͸ڍಈ͕ҟͳΔ Code - ͲΕΛ࢖͏? - VectorDrawableCompat#create() - ContextCompat#getDrawable() - ResrouceCompat#getDrwable() ContextCompat#getDrawable() Λ࢖͏
  6. VectorDrawableิ଍ ࢲతͳࡶײ ࠓ·Ͱ΋ SupportLibrary ͷ version ΍ Android Studio ͷ

    version Ͱ૊ΘͤͰ
 ڍಈ͕มΘ͓ͬͯΓɺະͩʹʮίϨͰେৎ෉ʯͱࢥ͑Δύλʔϯ͸ͳ͘ ʮࠓ͸ίϨ͕໰୊͕ͳ͍ॻ͖ํͩͱࢥ͍·͢ʯͱ͍͏ײ৮͔͋͠Γ·ͤΜɻ
  7. Android 8.0 (API level 26) also includes the following changes

    to specific methods: https://developer.android.com/about/versions/oreo/android-8.0-changes.html The startService() method now throws an IllegalStateException if an app targeting Android 8.0 tries to use that method in a situation when it isn't permitted to create background services. The new Context.startForegroundService() method starts a foreground service. The system allows apps to call Context.startForegroundService() even while the app is in the background. However, the app must call that service's startForeground() method within five seconds after the service is created.
  8. Service#startForeground https://developer.android.com/reference/android/app/Service.html#startForeground(int, android.app.Notification) Android 7.1 ͔Β startForeground() ͸ Notification Λදࣔͤͣʹར༻͢Δ

    ͜ͱ͕Ͱ͖ͳ͘ͳΓ·ͨ͠ɻ ͦͷͨΊैདྷɺόοΫάϥ΢ϯυͰαʔϏεΛར༻ͯ͠ߦ͍ͬͯͨॲཧ͸Ϣʔ βʔʹରͯ͠ॲཧঢ়ଶΛ໌ࣔతʹߦΘΕΔΑ͏ʹͳΓ·͢ɻ [developer preview] Foreground Service Can Avoid Notification Requirement https://issuetracker.google.com/issues/37105213
  9. ͦͷଞ • େ൒ͷ҉໧తͳϒϩʔυΩϟετ͸ΞϓϦͰϚχϑΣετΛ࢖༻ͯ͠ొ࿥͢Δ͜ͱ͕ Ͱ͖·ͤΜɻҠߦϚχϡΞϧʹ΋ manifest ͷͱ͜ΖͰࢦఠ͞Ε͍ͯ·͢ɻ
 com.android.launcher.action.INSTALL_SHORTCUT ͸୺຤ʹಋೖ͞Ε͍ͯΔϗʔϜΞϓ ϦશͯʹΞϓϦͷγϣʔτΧοτΛ࡞੒͢Δ҉໧తͳ intent

    Λ௨஌͢Δ΋ͷͰ͕ͨ͠ ར༻Ͱ͖ͳ͍ͷͰ ShortcutManager#requestPinShortcut() Λ࢖͏͜ͱʹͳΓ·͢ • ANDROID_ID ͕ΞϓϦຖʹҟͳΓ·͢ɺಉ͡ΞϓϦͰ΋ॺ໊͕ҟͳΕ͹ҟͳΔ ANDROID_ID ׂ͕ΓৼΒΕ·͢ɻ