Parse-SDK-Flutter icon indicating copy to clipboard operation
Parse-SDK-Flutter copied to clipboard

Push notification problem with iOS

Open gadgetreviews opened this issue 3 years ago • 7 comments

New Issue Checklist

Issue Description

I am getting error messages when sending push notification with parse server to iOS device. I am not sure if this is a parse issue or firebase issue. I have already opened this issue at flutterfire: https://github.com/firebase/flutterfire/issues/8719 It could also possible this is related to parse. So I am opening another issue at here.

Steps to reproduce

This is parse server push configuraiton:

push: {
    android: {
      apiKey: 'apikey'
    },
    ios: [
      {
	token: {
          key: 'key.p8',
          keyId: 'keyId',
          teamId: 'teamId',
        },
        topic: 'com.company.app',
        production: true
      },
      {
	token: {
          key: 'key.p8',
          keyId: 'keyId',
          teamId: 'teamId',
        },
        topic: 'com.company.app',
        production: false
      }
    ] 
  },

This is how I send push notification with parse cloud code:

query = new Parse.Query(Parse.Installation);
            query.equalTo("profileId", userProfileId);
            Parse.Push.send({
                where: query,
                data: {
                    "title": "title",
                    "alert": "alert",
                    "profileId": currentUserProfileId,
                    "displayName": currentUserProfile.get("nickname"),
                    "pictureUrl": currentUserPicture,
                    "time": Date.now(),
                    "notification": {
                        "title": "title",
                        "body": "some text"
                    }
                }
            }, {
                success: function() {
                    console.log("#### PUSH OK");
                },
                error: function(error) {
                    console.log("#### PUSH ERROR" + error.message);
                },
                useMasterKey: true
            });

Update AppDelegate.swift file as below:

import UIKit
import Flutter
import Firebase
import FirebaseMessaging
import UserNotifications

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    if #available(iOS 10.0, *) {
      // For iOS 10 display notification (sent via APNS)
      UNUserNotificationCenter.current().delegate = self
      let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
      UNUserNotificationCenter.current().requestAuthorization(
        options: authOptions,
        completionHandler: { _, _ in }
      )
    } else {
      let settings: UIUserNotificationSettings =
        UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
      application.registerUserNotificationSettings(settings)
    }

    FirebaseApp.configure()
    GeneratedPluginRegistrant.register(with: self)
    application.registerForRemoteNotifications()
    registerForPushNotifications()
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }

  override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
      
    let tokenParts = deviceToken.map { data in String(format: "%02.2hhx", data) }
    let token = tokenParts.joined()
    print("Device Token: \(token)")
    Messaging.messaging().apnsToken = deviceToken
    return super.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
  }

  override func application(_ application: UIApplication, didReceiveRemoteNotification notification: [AnyHashable : Any],
                                  fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    // Handle it for firebase messaging analytics
    if ((notification["gcm.message_id"]) != nil) {
        Messaging.messaging().appDidReceiveMessage(notification)
    }
    return super.application(application, didReceiveRemoteNotification: notification, fetchCompletionHandler: completionHandler)
  }

  func registerForPushNotifications() {
    UNUserNotificationCenter.current()
    .requestAuthorization(
      options: [.alert, .sound, .badge]) { [weak self] granted, _ in
      print("Permission granted: \(granted)")
      guard granted else { return }
      self?.getNotificationSettings()
    }
  }

  func getNotificationSettings() {
    UNUserNotificationCenter.current().getNotificationSettings { settings in
      print("Notification settings: \(settings)")
      guard settings.authorizationStatus == .authorized else { return }
      DispatchQueue.main.async {
        UIApplication.shared.registerForRemoteNotifications()
      }
    }
  }

  override func application(
    _ application: UIApplication,
    didFailToRegisterForRemoteNotificationsWithError error: Error
  ) {
    print("Failed to register: \(error)")
    return super.application(application, didFailToRegisterForRemoteNotificationsWithError: error)
  }
}

main.dart:

void main() {
  init();
}

void init() async {
  WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
...
  await initBackgroundNotifications();
  runApp(const MyApp());
}

FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
const AndroidInitializationSettings initializationSettingsAndroid = AndroidInitializationSettings('@mipmap/ic_launcher');
IOSInitializationSettings initializationSettingsIOS = const IOSInitializationSettings(onDidReceiveLocalNotification: onDidReceiveLocalNotification);

Future<dynamic> onDidReceiveLocalNotification(int id, String? title, String? body, String? payload) async {
  Shared.debug("onDidReceiveLocalNotification received");
}

MacOSInitializationSettings initializationSettingsMacOS = const MacOSInitializationSettings();
final InitializationSettings initializationSettings = InitializationSettings(
    android: initializationSettingsAndroid,
    iOS: initializationSettingsIOS,
    macOS: initializationSettingsMacOS
);

Future<void> initBackgroundNotifications() async {
// initialise the plugin. app_icon needs to be a added as a drawable resource to the Android head project
  await flutterLocalNotificationsPlugin.initialize(
    initializationSettings,
//    onSelectNotification: selectNotification
  );
  FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
}

Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
  // If you're going to use other Firebase services in the background, such as Firestore,
  // make sure you call `initializeApp` before using other Firebase services.
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );
  Shared.debug("Handling a background message: ${message.messageId}");
  const NotificationDetails platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics);
  await flutterLocalNotificationsPlugin.show(
    0,
    'project',
    text,
    platformChannelSpecifics,
    payload: data["title"],
  );
}

  Future<void> initFirebaseMessaging() async {
    Shared.debug('initFirebaseMessaging started');
    FirebaseMessaging.onMessage.listen((RemoteMessage message) {
      Shared.debug('Got a message whilst in the foreground!');
...
    });

    FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
      Shared.debug("onMessageOpenedApp");
    });
  }

Actual Outcome

final deviceToken = FirebaseMessaging.instance.getToken(); returns 163 character long string as token. But AppDelegate.swift returns 64 character long string and when I try to send push message with the token that firebase returns, I get following error on parse server log when sending push notification:

ERR! parse-server-push-adapter APNS APNS error transmitting to device ..... with status 400 and reason BadDeviceToken .... represents 163 character long string token which is returned from firebase as device token.

When I force to use 64 character long string as token which returned from AppDelegate.swift, by manually hard coding 64 character device token for testing purposes, in this case parse server does not give error in log and send push notification is success if the app is in background mode. But background mode code in flutter code did not fired and not executed and also foreground notification code don't run.

Expected Outcome

Device token from firebase and from AppDelegate.swift should be identical, and parse server should not log error message and send push notification to iOS device.

Environment

Dart SDK 2.17.0
Flutter SDK 3.0.0

dependencies:
- back_button_interceptor 5.1.0 [collection flutter]
- badges 2.0.2 [flutter]
- cached_network_image 3.2.1 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network_image_web]
- clipboard 0.1.3 [flutter]
- connectivity_plus 1.4.0 [flutter meta connectivity_plus_platform_interface connectivity_plus_linux connectivity_plus_macos connectivity_plus_web connectivity_plus_windows]
- cupertino_icons 1.0.4
- device_info 2.0.3 [flutter device_info_platform_interface]
- devicelocale 0.5.1 [flutter flutter_web_plugins]
- firebase_analytics 9.1.8 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter]
- firebase_auth 3.3.18 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 1.17.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_messaging 11.4.0 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
- flutter_dotenv 5.0.2 [flutter]
- flutter_launcher_icons 0.9.2 [args image path yaml]
- flutter_local_notifications 9.5.3+1 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone]
- flutter_login_facebook 1.4.1 [flutter list_ext]
- flutter_login_vk 2.2.1 [async flutter]
- flutter_native_splash 2.1.3+1 [args image js meta path xml yaml universal_io flutter flutter_web_plugins]
- flutter_vibrate 1.3.0 [flutter]
- fluttertoast 8.0.9 [flutter flutter_web_plugins]
- google_mobile_ads 1.2.0 [meta flutter]
- introduction_screen 3.0.2 [flutter dots_indicator collection]
- location 4.4.0 [flutter location_platform_interface location_web]
- package_info_plus 1.4.2 [flutter package_info_plus_platform_interface package_info_plus_linux package_info_plus_macos package_info_plus_windows package_info_plus_web]
- parse_server_sdk_flutter 3.1.0 [flutter parse_server_sdk dio connectivity_plus shared_preferences path_provider package_info_plus sembast path]
- share_plus 4.0.4 [meta mime flutter share_plus_platform_interface share_plus_linux share_plus_macos share_plus_windows share_plus_web]
- shared_preferences 2.0.13 [flutter shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows]
- sign_in_with_apple 3.3.0 [flutter meta sign_in_with_apple_platform_interface sign_in_with_apple_web]
- url_launcher 6.1.0 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]

dev dependencies:
- flutter_lints 1.0.4 [lints]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph]

transitive dependencies:
- archive 3.3.0 [crypto path]
- args 2.3.0
- async 2.8.2 [collection meta]
- boolean_selector 2.1.0 [source_span string_scanner]
- cached_network_image_platform_interface 1.0.0 [flutter flutter_cache_manager]
- cached_network_image_web 1.0.1 [flutter flutter_cache_manager cached_network_image_platform_interface]
- characters 1.2.0
- charcode 1.3.1
- clock 1.1.0
- collection 1.16.0
- connectivity_plus_linux 1.3.0 [flutter connectivity_plus_platform_interface meta nm]
- connectivity_plus_macos 1.2.1 [connectivity_plus_platform_interface flutter]
- connectivity_plus_platform_interface 1.2.0 [flutter meta plugin_platform_interface]
- connectivity_plus_web 1.2.0 [connectivity_plus_platform_interface flutter_web_plugins flutter]
- connectivity_plus_windows 1.2.0 [connectivity_plus_platform_interface flutter]
- crypto 3.0.1 [collection typed_data]
- dbus 0.7.3 [args ffi meta xml]
- device_info_platform_interface 2.0.1 [flutter meta plugin_platform_interface]
- dio 4.0.6 [http_parser path]
- dots_indicator 2.1.0 [flutter]
- fake_async 1.3.0 [clock collection]
- ffi 1.1.2
- file 6.1.2 [meta path]
- firebase_analytics_platform_interface 3.1.6 [firebase_core flutter meta plugin_platform_interface]
- firebase_analytics_web 0.4.0+13 [firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js]
- firebase_auth_platform_interface 6.2.6 [firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 3.3.15 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta]
- firebase_core_platform_interface 4.4.0 [collection flutter meta plugin_platform_interface]
- firebase_core_web 1.6.4 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_messaging_platform_interface 3.5.0 [firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 2.4.0 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta]
- flutter_blurhash 0.6.4 [flutter]
- flutter_cache_manager 3.3.0 [clock collection file flutter http path path_provider pedantic rxdart sqflite uuid]
- flutter_local_notifications_linux 0.4.2 [flutter flutter_local_notifications_platform_interface dbus path xdg_directories]
- flutter_local_notifications_platform_interface 5.0.0 [flutter plugin_platform_interface]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math]
- http 0.13.4 [async http_parser meta path]
- http_parser 4.0.0 [charcode collection source_span string_scanner typed_data]
- idb_shim 2.0.1 [sembast collection path js meta]
- image 3.1.3 [archive meta xml]
- intl 0.17.0 [clock path]
- js 0.6.4
- lints 1.0.1
- list_ext 1.0.4 [quiver collection]
- location_platform_interface 2.3.0 [flutter meta plugin_platform_interface]
- location_web 3.1.1 [flutter flutter_web_plugins http_parser js location_platform_interface meta]
- matcher 0.12.11 [stack_trace]
- material_color_utilities 0.1.4
- meta 1.7.0
- mime 1.0.2
- mime_type 1.0.0
- nm 0.5.0 [dbus]
- octo_image 1.0.1 [flutter flutter_blurhash]
- package_info_plus_linux 1.0.5 [package_info_plus_platform_interface flutter path]
- package_info_plus_macos 1.3.0 [flutter]
- package_info_plus_platform_interface 1.0.2 [flutter meta plugin_platform_interface]
- package_info_plus_web 1.0.5 [flutter flutter_web_plugins http meta package_info_plus_platform_interface]
- package_info_plus_windows 1.0.5 [package_info_plus_platform_interface ffi flutter win32]
- parse_server_sdk 3.1.0 [dio http web_socket_channel sembast sembast_web xxtea uuid meta path mime_type]
- path 1.8.1
- path_provider 2.0.9 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows]
- path_provider_android 2.0.12 [flutter path_provider_platform_interface]
- path_provider_ios 2.0.8 [flutter path_provider_platform_interface]
- path_provider_linux 2.1.5 [ffi flutter path path_provider_platform_interface xdg_directories]
- path_provider_macos 2.0.5 [flutter path_provider_platform_interface]
- path_provider_platform_interface 2.0.3 [flutter platform plugin_platform_interface]
- path_provider_windows 2.0.5 [ffi flutter path path_provider_platform_interface win32]
- pedantic 1.11.1
- petitparser 4.4.0 [meta]
- platform 3.1.0
- plugin_platform_interface 2.1.2 [meta]
- process 4.2.4 [file path platform]
- quiver 3.0.1+1 [matcher]
- rxdart 0.27.3
- sembast 3.2.0 [meta path synchronized]
- sembast_web 2.0.1+1 [sembast idb_shim]
- share_plus_linux 3.0.0 [share_plus_platform_interface file flutter meta url_launcher]
- share_plus_macos 3.0.0 [share_plus_platform_interface flutter]
- share_plus_platform_interface 3.0.2 [flutter meta mime plugin_platform_interface]
- share_plus_web 3.0.0 [share_plus_platform_interface url_launcher flutter flutter_web_plugins meta]
- share_plus_windows 3.0.0 [share_plus_platform_interface flutter meta url_launcher]
- shared_preferences_android 2.0.11 [flutter shared_preferences_platform_interface]
- shared_preferences_ios 2.1.0 [flutter shared_preferences_platform_interface]
- shared_preferences_linux 2.1.0 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface]
- shared_preferences_macos 2.0.3 [flutter shared_preferences_platform_interface]
- shared_preferences_platform_interface 2.0.0 [flutter]
- shared_preferences_web 2.0.3 [flutter flutter_web_plugins shared_preferences_platform_interface]
- shared_preferences_windows 2.1.0 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface]
- sign_in_with_apple_platform_interface 1.0.0 [flutter plugin_platform_interface meta]
- sign_in_with_apple_web 1.0.1 [flutter flutter_web_plugins sign_in_with_apple_platform_interface js]
- sky_engine 0.0.99
- source_span 1.8.2 [collection path term_glyph]
- sqflite 2.0.2 [flutter sqflite_common path]
- sqflite_common 2.2.1 [synchronized path meta]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- string_scanner 1.1.0 [charcode source_span]
- synchronized 3.0.0+2
- term_glyph 1.2.0
- test_api 0.4.9 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher]
- timezone 0.8.0 [path]
- typed_data 1.3.0 [collection]
- universal_io 2.0.4 [collection crypto meta typed_data]
- url_launcher_android 6.0.15 [flutter url_launcher_platform_interface]
- url_launcher_ios 6.0.15 [flutter url_launcher_platform_interface]
- url_launcher_linux 3.0.0 [flutter url_launcher_platform_interface]
- url_launcher_macos 3.0.0 [flutter url_launcher_platform_interface]
- url_launcher_platform_interface 2.0.5 [flutter plugin_platform_interface]
- url_launcher_web 2.0.9 [flutter flutter_web_plugins url_launcher_platform_interface]
- url_launcher_windows 3.0.0 [flutter url_launcher_platform_interface]
- uuid 3.0.6 [crypto]
- vector_math 2.1.2
- web_socket_channel 2.1.0 [async crypto stream_channel]
- win32 2.5.1 [ffi]
- xdg_directories 0.2.0+1 [meta path process]
- xml 5.3.1 [collection meta petitparser]
- xxtea 2.1.0
- yaml 3.1.0 [collection source_span string_scanner]

Parse Flutter SDK

  • SDK version: 3.1.0
  • Operating system version: iOS

Server

  • Parse Server version: 5.2.1

Logs

ERR! parse-server-push-adapter APNS APNS error transmitting to device ..... with status 400 and reason BadDeviceToken

.... represents 163 character long string token which is returned from firebase as device token.

gadgetreviews avatar May 20 '22 15:05 gadgetreviews

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

Situation has changed

Update 1: I found an undocumented function call at firebase flutter plugin to get APNS token final deviceToken = FirebaseMessaging.instance.getAPNSToken(); returns APNS token correctly. So the problem below has been solved and no longer exists: ERR! parse-server-push-adapter APNS APNS error transmitting to device ..... with status 400 and reason BadDeviceToken

Update 2: But when I send test push notification messages from Firebase Console to a real iOS device with the same code I write, flutter handler is executed. But when I send FCM message with parse cloud, I get following error message at console log.

Warning: Application delegate received call to -application:didReceiveRemoteNotification:fetchCompletionHandler: but the completion handler was never called.

So there should be a problem when sending push message with parse cloud code. I could send the wrong payload to iOS device or there could be a problem with parse server or parse cloud code or some other problem.

I am using this parse cloud code to send push message to iOS device. Do you thing, is there any problem with this code?

            Parse.Push.send({
                where: query,
                data: {
                    "push_type": "background",
//                    "push_type": "alert",
                    "content-available": 1,
                    "priority": 5,
                    "title": "title",
                    "alert": "text",
                    "badge": 1,
                    "profileId": currentUserProfileId,
                    "displayName": currentUserProfile.get("nickname"),
                    "pictureUrl": currentUserPicture,
                    "time": Date.now(),
                    "notification": {
                        "title": "title",
                        "body": "text"
                    }
                }            
            }, {
                success: function() {
                    console.log("#### PUSH OK");
                },
                error: function(error) {
                    console.log("#### PUSH ERROR" + error.message);
                },
                useMasterKey: true
            });

gadgetreviews avatar May 23 '22 13:05 gadgetreviews

Hi, @gadgetreviews .

This is not a bug in the package, as it does not Support Notification.

I started to create a package to handle Parse Server notifications with Flutter and I found some limitations.

My suggestion is not to use Parse native methods (server and client).

Use the firebase_messaging package in Flutter and make an API call in FCM through Cloud Code to send the notification.

You will retrieve the token with FirebaseMessaging methods and save it in the Installation class.

Then in Cloud Code, retrieves the Installation Class tokens and sends the notification through the FCM API, calling an http method. Not use Parse.Push.send.

In Parse Server you will not configure Apple certificates. You will do this directly in your Firebase project.

This will save you the trouble of having to write native code.

I have a working example project. Was working with Back4app to document this.

I will publish the example project to my repository and then share the link.

RodrigoSMarques avatar May 23 '22 13:05 RodrigoSMarques

Hi, @gadgetreviews .

This is not a bug in the package, as it does not Support Notification.

I started to create a package to handle Parse Server notifications with Flutter and I found some limitations.

My suggestion is not to use Parse native methods (server and client).

Use the firebase_messaging package in Flutter and make an API call in FCM through Cloud Code to send the notification.

You will retrieve the token with FirebaseMessaging methods and save it in the Installation class.

Then in Cloud Code, retrieves the Installation Class tokens and sends the notification through the FCM API, calling an http method. Not use Parse.Push.send.

In Parse Server you will not configure Apple certificates. You will do this directly in your Firebase project.

This will save you the trouble of having to write native code.

I have a working example project. Was working with Back4app to document this.

I will publish the example project to my repository and then share the link.

Thanks for reply. I believe it will work if I can find how to process data inside AppDelegate.swift file inside didReceiveRemoteNotification fun

  // [START receive_message]
    override func application(_ application: UIApplication,
                   didReceiveRemoteNotification userInfo: [AnyHashable: Any],
                   fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult)
                     -> Void) {
    // If you are receiving a notification message while your app is in the background,
    // this callback will not be fired till the user taps on the notification launching the application.
    // TODO: Handle data of notification
    // With swizzling disabled you must let Messaging know about the message, for Analytics
    // Messaging.messaging().appDidReceiveMessage(userInfo)
    // Print message ID.
    if let messageID = userInfo[gcmMessageIDKey] {
      print("Message ID: \(messageID)")
    }

    // Print full message.
    print(userInfo)

    completionHandler(UIBackgroundFetchResult.newData)
  }

When I send push notification to iOS device, this didReceiveRemoteNotification function executes and prints the payload message, but it did not call flutter function and pass the payload to flutter app. If I don't send data-available=1 to iOS device, this didReceiveRemoteNotification does not call and does not print the payload. So if I set data-available=1, something is delivered to app and to didReceiveRemoteNotification. So there is one more step to be done. To make didReceiveRemoteNotification function to call flutter code. But how?

gadgetreviews avatar May 23 '22 14:05 gadgetreviews

Hi, @gadgetreviews .

This is not a bug in the package, as it does not Support Notification.

I started to create a package to handle Parse Server notifications with Flutter and I found some limitations.

My suggestion is not to use Parse native methods (server and client).

Use the firebase_messaging package in Flutter and make an API call in FCM through Cloud Code to send the notification.

You will retrieve the token with FirebaseMessaging methods and save it in the Installation class.

Then in Cloud Code, retrieves the Installation Class tokens and sends the notification through the FCM API, calling an http method. Not use Parse.Push.send.

In Parse Server you will not configure Apple certificates. You will do this directly in your Firebase project.

This will save you the trouble of having to write native code.

I have a working example project. Was working with Back4app to document this.

I will publish the example project to my repository and share the link.

Hey if you found any perfect solution then please share it with me. its really help full for me,

I have the same requirement with the back4app backend and flutter app notification with customized notification data as per requirement,

i try to found solution but not any where found perfect code or working solution then i decide to go with native code i have done with native android but there is suck in ios side setup and not understand what to do, please suggest good solution

kaushikgodhani avatar Jul 03 '22 19:07 kaushikgodhani

Hi, @gadgetreviews . This is not a bug in the package, as it does not Support Notification. I started to create a package to handle Parse Server notifications with Flutter and I found some limitations. My suggestion is not to use Parse native methods (server and client). Use the firebase_messaging package in Flutter and make an API call in FCM through Cloud Code to send the notification. You will retrieve the token with FirebaseMessaging methods and save it in the Installation class. Then in Cloud Code, retrieves the Installation Class tokens and sends the notification through the FCM API, calling an http method. Not use Parse.Push.send. In Parse Server you will not configure Apple certificates. You will do this directly in your Firebase project. This will save you the trouble of having to write native code. I have a working example project. Was working with Back4app to document this. I will publish the example project to my repository and share the link.

Hey if you found any perfect solution then please share it with me. its really help full for me,

I have the same requirement with the back4app backend and flutter app notification with customized notification data as per requirement,

i try to found solution but not any where found perfect code or working solution then i decide to go with native code i have done with native android but there is suck in ios side setup and not understand what to do, please suggest good solution

The example has outdated versions of FirebaseMessaging.

I'll update and example, check if nothing has changed and provide a configuration/use guide with Back4app.

I plan to have it completed by the end of next week.

RodrigoSMarques avatar Jul 03 '22 19:07 RodrigoSMarques

Ok please update when your example is ready its really helpful and if possible please do fast I need urgently

kaushikgodhani avatar Jul 04 '22 04:07 kaushikgodhani

ParsePush added in #914 please use this document and If you still have problems, reopen issues

mbfakourii avatar May 23 '23 14:05 mbfakourii

ParsePush added in #914 please use this document and If you still have problems, reopen issues

documentation link is broken. Would you please provide a working link to documentation? Thanks

cool2apps avatar Jun 20 '23 18:06 cool2apps

ParsePush added in #914 please use this document and If you still have problems, reopen issues

documentation link is broken. Would you please provide a working link to documentation? Thanks

https://docs.parseplatform.org/flutter/guide/#push-notifications

mbfakourii avatar Jun 20 '23 19:06 mbfakourii