LoginSignup
0
0

More than 1 year has passed since last update.

【Android】SplitInstallManagerのListenerで期待する動作がしなくて困った話(備忘録)

Last updated at Posted at 2021-06-07

環境

  • PC
    • M1 MacBook Air
  • Android Studio
    • Arctic Fox 2020.3.1 Beta 3
  • Google Play Core Library
    • com.google.android.play:core-ktx:1.8.1

困ったこと

DFMを実装する際、 SplitInstallStateUpdatedListenerREQUIRES_USER_CONFIRMATION を通らないことがある

sample.kt
    private val listener = SplitInstallStateUpdatedListener { state ->
        when (state.status()) {
            SplitInstallSessionStatus.REQUIRES_USER_CONFIRMATION -> {
                splitInstallManager.startConfirmationDialogForResult(state, this, DFM_REQUEST_CODE)
            }
            SplitInstallSessionStatus.DOWNLOADING -> {
                // do something
            }
            else -> {
                // do something
            }
    }

サンプルコード↓
https://github.com/sasakitomohiro/DFMSample

原因

REQUIRES_USER_CONFIRMATIONはモジュールサイズが150MBを超える場合でないと通らないらしい?ことが原因っぽい
その他、wifi接続している状態かどうかや端末によって挙動が変わるらしい
https://issuetracker.google.com/issues/171501820

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0