Skip to content

IllegalArgumentException not attached to window manager #19

@paulpv

Description

@paulpv
View=DecorView@9cb1f85[HomeActivity] not attached to window manager
android.view.WindowManagerGlobal.findViewLocked (WindowManagerGlobal.java:533)
android.view.WindowManagerGlobal.removeView (WindowManagerGlobal.java:433)
android.view.WindowManagerImpl.removeViewImmediate (WindowManagerImpl.java:124)
android.app.Dialog.dismissDialog (Dialog.java:518)
android.app.Dialog.dismiss (Dialog.java:501)
com.vorlonsoft.android.rate.AppRate.dismissRateDialog (AppRate.java:663)
com.vorlonsoft.android.rate.AppRate.showRateDialog (AppRate.java:628)
com.vorlonsoft.android.rate.AppRate.showRateDialogIfMeetsConditions (AppRate.java:118)
com.....HomeActivity.onCreate (HomeActivity.kt:330)

The above is happening for less than 1% of my users.

Here is my Activity's code:

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        if (isFinishing) {
            return
        }

        // https://github.com/Vorlonsoft/AndroidRate#micro-configuration
        @Suppress("SimplifyBooleanWithConstants")
        AppRate.with(this)
                .setInstallDays(7)
                .setLaunchTimes(10)
                .setRemindInterval(3)
                .setRemindLaunchesNumber(10)
                .setMessage(R.string.pb_rate_dialog_message)
                .setDebug(true && BuildConfig.DEBUG)
                .setOnClickButtonListener { which ->
                    run {
                        PbLog.d(TAG, "AppRate.OnClickButtonListener(which=$which)")
                        val result = when (which.toInt()) {
                            DialogInterface.BUTTON_POSITIVE -> {
                                "RateNow"
                            }
                            DialogInterface.BUTTON_NEUTRAL -> {
                                "Later"
                            }
                            DialogInterface.BUTTON_NEGATIVE -> {
                                "Never"
                            }
                            else -> {
                                "UNKNOWN($which)"
                            }
                        }
                        val phoneModelName = PbPlatformUtils.getDeviceName()
                        hiveManager!!.analyticsManager.appRatePromptButtonClicked(result, phoneModelName)
                    }
                }
                .monitor()
        if (AppRate.with(this).storeType == StoreType.GOOGLEPLAY) {
            if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this) != ConnectionResult.SERVICE_MISSING) {
                AppRate.showRateDialogIfMeetsConditions(this)
            }
        } else {
            AppRate.showRateDialogIfMeetsConditions(this)
        }

        setContentView(R.layout.activity_home)

        ...
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions