-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash when using in combination with firebase_messaging #45
Comments
Hi,Seems your poActivity is null, can you show me your call to your WifiIotPlugin constructor ? |
The WifiIotPlugin contructor is called from This is my Application.java, it is missing anything? Maybe add a call to package com.my.app;
import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;
public class Application extends FlutterApplication implements PluginRegistrantCallback {
@Override
public void onCreate() {
super.onCreate();
FlutterFirebaseMessagingService.setPluginRegistrant(this);
}
@Override
public void registerWith(PluginRegistry registry) {
GeneratedPluginRegistrant.registerWith(registry);
}
} |
@Niek @alternadom Facing the same issue. Did you find any solution? |
A similar problem occurred with This was the workaround they implemented for it: flutter/plugins#1255 In conclusion: A plugin method channel can be called without activity. Hence not registering plugin when activity is null is the workaround [as used in the PR mentioned] |
I confirm that this fixes the issue. @Niek Please try and report Put this in dependencies:
flutter:
sdk: flutter
firebase_core: 0.4.0+9
firebase_messaging: ^5.1.6
wifi_iot:
git:
#FIXME https://github.com/alternadom/WiFiFlutter/issues/45
#url: "https://github.com/alternadom/WiFiFlutter.git"
url: "https://github.com/daadu/WiFiFlutter.git"
ref: "#45" |
Thanks @daadu - I can confirm this fixes the issue! @alternadom can you merge the change? |
making plugin foreground only
When using firebase_messaging, you need to to add your own Application class that implements PluginRegistrantCallback. However, this causes WiFiFlutter to crash with the following trace:
It's coming from this call: https://github.com/alternadom/WiFiFlutter/blob/a8bb37f87425e45d2947e6c7c4e8b9416c886364/android/src/main/java/com/alternadom/wifiiot/WifiIotPlugin.java#L65
The text was updated successfully, but these errors were encountered: