ben-xD / push

Push notifications in Flutter without firebase_messaging.
https://pub.dev/packages/push
36 stars 22 forks source link

iOS `addOnBackgroundMessage` and `addOnMessage` not working #48

Open a1ssat opened 5 months ago

a1ssat commented 5 months ago
xcrun simctl push booted com.app.app push.json
{
  "aps": {
    "alert": {
      "title": "Test",
      "body": "hello message"
    }
  }
}

onInit(){

Push.instance.addOnMessage((message) {
      log('RemoteMessage received while app is in foreground:\n'
          'RemoteMessage.Notification: ${message.notification} \n'
          ' title: ${message.notification?.title.toString()}\n'
          ' body: ${message.notification?.body.toString()}\n'
          'RemoteMessage.Data: ${message.data}');
      showMaterialBanner(message.toString());
    });

    Push.instance.addOnBackgroundMessage((message) {
      log('RemoteMessage received while app is in background:\n'
          'RemoteMessage.Notification: ${message.notification} \n'
          ' title: ${message.notification?.title.toString()}\n'
          ' body: ${message.notification?.body.toString()}\n'
          'RemoteMessage.Data: ${message.data}');
      _showMaterialBanner(message.toString());
    });

}
ben-xD commented 5 months ago

There's not enough information here yet.