0

After upgraded to embedded v2 I was never able to get PNs working on android again, after lots of searching and various code samples I did manage to get rid of the terminal error, but while I know the notifications are definitely arriving, they foreground nor background notifications are running.

I have flutter_local_notifications setup, I even tried rolling back to v2 after getting the terminal errors gone, and still nothing.

I have since tried upgrading to v8 of firebase_messaging which definitely seems like a great improvement but all that happened after that was iOS stopped rendering them as well.

I have been up and down the docs for both plugins, I have made sure to add the required proguard and K8 configurations, but as I understand that is for release and even in dev I cannot get the showing up on the phone or simulator.

Application.java

package com.example.mpkgname;

import io.flutter.app.FlutterApplication;

public class Application extends FlutterApplication {
    @Override
    public void onCreate() {
        super.onCreate();
    }
}

MainActivity.java

package com.example.member_ui_flutter;

import io.flutter.embedding.android.FlutterActivity;

public class MainActivity extends FlutterActivity {
}

I have setup requestPermission and setForegroundNotificationPresentationOptions for iOS as well as onMessage.listen and onBackgroundMessage

Notification display logic:

    final androidPlatformChannelSpecifics = const AndroidNotificationDetails(
      'channelid',
      'flutterfcm',
      'your channel description',
      playSound: true,
      enableVibration: true,
      importance: Importance.max,
      priority: Priority.high,
    );
    final iOSPlatformChannelSpecifics = const IOSNotificationDetails();
    final platformChannelSpecifics = NotificationDetails(
      android: androidPlatformChannelSpecifics,
      iOS: iOSPlatformChannelSpecifics,
    );
    final payload = _setupNotificationPayload(message);

    await flutterLocalNotificationsPlugin.show(
      0,
      payload['title'],
      payload['body'],
      platformChannelSpecifics,
      payload: jsonEncode(payload),
    );

I honestly do not know if this is even enough info to help, I am at a complete loss now, I am getting no errors, even if I wrap a try-catch around the notification display, there are no apparent platform errors. Nothing is tripping up in debug mode

RemeJuan
  • 823
  • 9
  • 25
  • Could you please clarify the issue? Where/how do you handle notifications? I'm assuming your callback is being called - that's how you know your notifications do get delivered. It would be appropriate to post that piece of code, while empty `Application` and `MainActivity` classes appear to be irrelevant to this particular issue. – Riwen Jan 19 '21 at 11:46
  • @Riwen, the last code snippet is the display logic, that's the config for flutter_local_notifications `flutterLocalNotificationsPlugin.show`, as for the Application and MainActivity, while I am sure they should be empty, maybe they should not, providing all the relevant context I can think of. – RemeJuan Jan 19 '21 at 11:48

0 Answers0