adee42 / flutter_keyboard_visibility

MIT License
237 stars 142 forks source link

Crashes application when application run in background #32

Closed Sjosh-cronJ closed 5 years ago

Sjosh-cronJ commented 5 years ago

https://github.com/adee42/flutter_keyboard_visibility/blob/981f6794718654cb30b36e403505fe1ff502205b/android/src/main/java/com/github/adee42/keyboardvisibility/KeyboardVisibilityPlugin.java#L107

Sjosh-cronJ commented 5 years ago

I think you have to add an additional check

if(registrar.activity()!= null) {
            registrar.activity().getApplication().registerActivityLifecycleCallbacks(instance);
        };
herasymchuk commented 5 years ago

When a background flutter view tries to register the plugin, the registrar has no activity. Could you please add a check as @Sjosh-cronJ have mentioned above?

pbouttier commented 4 years ago

Hi, i have the same problem, and the solution worked.

This need to be implemented, to avoid dirty edit :)

remoteportal commented 4 years ago

How do I fix the problem? The fix needs to be added to this package's code, right? I don't have access to that.