pinkfish / flutter_native_timezone

Apache License 2.0
78 stars 156 forks source link

Support for background calls #16

Closed nt4f04uNd closed 3 years ago

nt4f04uNd commented 3 years ago

This plugin is not adapted to work with background messages from firebase_messaging and thus the messages plugin throws MissingPluginException(No implementation found for method getLocalTimezone on channel flutter_native_timezone) if you try to get timezone in background message handler. I wanted to use your plugin to schedule notifications with flutter_local_notifications.

nt4f04uNd commented 3 years ago

Fixed with https://stackoverflow.com/questions/59446933/pluginregistry-cannot-be-converted-to-flutterengine#comment114178264_60958130 So I added

override fun registerWith(pluginRegistry: PluginRegistry) {
    FirebaseMessagingPlugin.registerWith(pluginRegistry.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"))
    FlutterNativeTimezonePlugin.registerWith(pluginRegistry.registrarFor("com.whelksoft.flutter_native_timezone.FlutterNativeTimezonePlugin"))
}