I am working with firebase messaging. I followed the steps as given in readme of the plugin. But my application .java is giving an error.
Application.java
package com.app.demoapp;
import com.transistorsoft.flutter.backgroundfetch.BackgroundFetchPlugin;
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;
public class Application extends FlutterApplication implements PluginRegistry.PluginRegistrantCallback {
public void onCreate() {
super.onCreate();
FlutterFirebaseMessagingService.setPluginRegistrant(this);
BackgroundFetchPlugin.setPluginRegistrant(this);
}
@Override
public void registerWith(PluginRegistry registry) {
GeneratedPluginRegistrant.registerWith(registry);
}
}
Error:
error: cannot find symbol
FlutterFirebaseMessagingService.setPluginRegistrant(this);
^
symbol: method setPluginRegistrant(Application)
location: class FlutterFirebaseMessagingService
1 error
I have faced the same problem and so far I have not found any solution
but If you want just show notification with out handle it in background and just lunch app when click on it
remove FlutterFirebaseMessagingService.setPluginRegistrant(this);
and the notification will work fine as Notification messages type
if you don't know about Notification type in fcm
refer to Message types
With FCM, you can send two types of messages to clients:
1- Notification messages, sometimes thought of as "display messages." These are handled by the FCM SDK automatically.
2- Data messages, which are handled by the client app.
so we use Notification messages here until find solution for handle Data messages
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With