Wednesday, December 7, 2022
HomeiOS Developmentandroid - How can we get flutter iOS information notification when the...

android – How can we get flutter iOS information notification when the app is in terminated state


I managed to make foreground and background notifications. However I can not get notifications when the app is in terminated display screen. However solely on iOS. Android is working effective.

Right here is the method briefly.
I’m utilizing sending server facet notifications. Android working effective in the intervening time. iOS not working. I take advantage of these notifications to get a video name display screen(or ios name display screen). My downside is I can not get information notifications to ios when it is in terminated state. However regular push notifications are coming.

That is the code I take advantage of for server facet

 $fields = array(

                'registration_ids' => array (
                    $login_device_token->token,
            ),
            "content_available"=> true,
            "precedence"=>"excessive",

                "notification" => array(
                    "sound"=> 'default',
                    
                ),
                    "information" => array(
                       
                        "kind" => $msg_type,
                        "id" => $msg_id,
                        "sub_no" => $sub_no,
                        "title" => $title,
                        "click_action" =>'FLUTTER_NOTIFICATION_CLICK'
                    ),
                   
            );

Right here is the onBackground perform

 FirebaseMessaging.onBackgroundMessage((RemoteMessage message) async {
  var initialMessage = await FirebaseMessaging.occasion
      .getInitialMessage()
      .then((worth) async {
    await myBackgroundMessageHandler(message.information);
    await initConnect();
  });
  print(' onMessageOpenedApp  ${message.information}');
  print(' onMessageOpenedApp Notification information:::: ');
  if (!_isCameCall) {

    _isCameCall = true;
    // ---------- Get Name Notification -------------------
    if (message.information['type'] == 'name') {
      debugPrint(
          '----------- Sending trought onBackgroundMessage----------');
      await myBackgroundMessageHandler(message.information);
      await initConnect();
    }
  }
});




Future<void> _firebaseMessagingBackgroundHandler(
        RemoteMessage message) async {
      var initialMessage = await FirebaseMessaging.occasion
          .getInitialMessage()
          .then((worth) async {
        await myBackgroundMessageHandler(message.information);
        await initConnect();
      });
      await Firebase.initializeApp();
     ;
      if (!_isCameCall) {
        _isCameCall = true;
        // ---------- Get Name Notification -------------------
        if (message.information['type'] == 'name') {
          debugPrint('name kind == name ------------');
          await myBackgroundMessageHandler(message.information);

// ---------- ANSWER AND REJECT CALL FUNCTIONS -----------------
          await initConnect();
        }
      }
    }

Me and my pal implementing this app. So do you guys have any thought to slove this difficulty?

I’m utilizing flutter_local_notification package deal and connectycube_flutter_call_kit .

I looked for an answer however nothing discovered. Any resolution for this matter very a lot appreciated.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments