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

Android @IO 19 [ja]

Android @IO 19 [ja]

Android @I/O 19 [ja]

More Decks by Daichi Furiya (Wasabeef)

Other Decks in Programming

Transcript

  1. Kotlin First? Java Language Kotlin Platform SDK support Yes Yes

    Android Studio support Yes Yes Lint Yes Yes Guided docs support Yes Yes API docs support Yes Yes AndroidX support Yes Yes AndroidX Kotlin-specific APIs (e.g. KTX, coroutines) N/A Yes Online training Best effort Yes Samples Best effort Yes Multi-platform Projects No Yes Jetpack Compose No Yes
  2. Foldable Live Caption Dark theme New location controls Android Q

    Scoped storage Bubbles Gestual Navigation And more..
  3. Scoped Storage ファイル場所 権限取得 アクセス方法 アンインストール時に削除 アプリ領域 - getExternalFilesDir() Yes

    メディア (写真, 動画, 音声) READ_EXTERNAL_STORAGE (他アプリのファイルを参照時) MediaStore No ダウンロード (書類など) - Storage Access Framework (システムピッカー) No
  4. Bubbles "// Create bubble intent val target = Intent(context, BubbleActivity"::class.java)

    val bubbleIntent = PendingIntent.getActivity(context, 0, target, flags) "// Create bubble metadata val bubbleData = Notification.BubbleMetadata.Builder() .setIcon(drawable) .setIntent(bubbleIntent) .build() "// Create notification val chatBot = Person.Builder() .setBot(true) .setName("BubbleBot") .setImportant(true) .build() val builder = Notification.Builder(context, CHANNEL_ID) .setContentIntent(contentIntent) .setSmallIcon(smallIcon) .setBubbleMetadata(bubbleData) .addPerson(chatBot)
  5. Jetpack compose CameraX Benchmark Security SavedState (ViewModel) ViewBinding New/Updated Jetpack

    libraries LiveData/Lifecycle Coroutines ViewPager2 Biometrics Prompt Enterprise Android for Cars ConstraintLayout 2.0
  6. Benchmark @RunWith(AndroidJUnit4"::class) class MyBenchmark { @get:Rule val benchmarkRule = BenchmarkRule()

    @Test fun benchmarkSomeWork() = benchmarkRule.measureRepeated { doSomeWork() } }
  7. Security val encryptedFile = EncryptedFile.Builder( File(context.getFilesDir(), "my_other_sensitive_data.txt"), context, masterKeyAlias, EncryptedFileKeyset.FileEncryptionScheme.AES256_GCM_HKDF_4KB

    ).build() "// Write to a file. try { val outputStream: FileOutputStream? = encryptedFile.openFileOutput() outputStream"?.apply { write("MY SUPER SECRET INFORMATION".toByteArray(Charset.forName("UTF-8"))) flush() close() } } catch (ex: IOException) { ""... }
  8. SavedState (ViewModel) val vm = ViewModelProvider(this, SavedStateVMFactory(this)) .get(SavedStateViewModel"::class.java) class SavedStateViewModel(

    private val state: SavedStateHandle ) : ViewModel() { "// ""... } SavedStateVMFactory を使い、SavedStateHandle をもらうだけ
  9. Data binding に似ている Android Gradle plugin (3.6+) レイアウトに <layout> タグを追加しない

    Annotation processors を使用しない 双方向バインディングは出来ない ViewBinding
  10. Biometric Prompt BiometricPrompt(this, executor, object : BiometricPrompt.AuthenticationCallback() { override fun

    onAuthenticationError(errorCode: Int, errString: CharSequence) { super.onAuthenticationError(errorCode, errString) "//todo } override fun onAuthenticationSucceeded(result: AuthenticationResult) { super.onAuthenticationSucceeded(result) "// todo } override fun onAuthenticationFailed() { super.onAuthenticationFailed() "// todo } }).authenticate(promptInfo)