Android BottomsheetDialogfragment lifecycle goes to onStop in android version <=12 & onPause >= 13 when ImagePicker is opened

17 Views Asked by At

I recently found an issue in my bottom sheet that, when I added a isAtLeast(Lifecycle.State.STARTED) check on fragment lifecycle, that it was giving true for android version >= 13 but false for <= 12, these checks were performed when I press back from the image picker activity provided by android

fragmentManager -> activity.supportFragmentManager

fun DialogFragment.showSafely(fragmentManager: FragmentManager, tag: String? = null) {
    if (fragmentManager.isStateSaved) return
        show(fragmentManager, tag)
}

Didn't found the root cause for this issue in different android version.

0

There are 0 best solutions below