AndroidRate icon indicating copy to clipboard operation
AndroidRate copied to clipboard

IllegalArgumentException not attached to window manager

Open paulpv opened this issue 4 years ago • 1 comments

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)

        ...
    }

paulpv avatar Sep 05 '19 00:09 paulpv

I am running 1.2.1, released Sep 13, 2018: https://github.com/Vorlonsoft/AndroidRate/releases/tag/1.2.1.Osaka

It seems like @AlexanderLS commited a fix for this on Nov 6, 2018: https://github.com/Vorlonsoft/AndroidRate/commit/803361f69f7693fa9fbb623335f2aeb9554c9eb7

If you released that version live then that should stop my few users from crashing.

paulpv avatar Sep 06 '19 21:09 paulpv