FIX: Android background permission check does not work.
During background operations, the Context received with Registrar.activity() is null. This is also in the doc for Registrar.activity().
The solution is to use an Activity (Registrar.activity()) for requestNotificationPermissions, which will only make sense in the foreground and use a Context (Registrar.context()) for getNotificationPermissionStatus which can also be used during background tasks, such as handling a (silent) push notification.
@gahms I was reading the documentation for the registrar, and in this case does it make more sense to use the activeContext?
https://api.flutter.dev/javadoc/io/flutter/plugin/common/PluginRegistry.Registrar.html#activeContext--
Yes! You are totally right. I have no idea why I looked at activeContext() and dismissed it. I have tested, and it works great.
Android Studio tells me I should upgrade the Gradle Plugin used and I am guessing Travis fails due to the use of an old Gradle Plugin - should I upgrade and commit to this PR, open a new PR or just ignore?