iOS Question Firebase Notifications

Semen Matusovskiy

Well-Known Member
Licensed User
Hi, guys --

I try to integrate

https://www.b4x.com/android/forum/t...tions-push-messages-server-not-required.68645

Erel's sample and sending tool work fine. But I need to accept messages from our webserver.

Android app (subscribed to "general" topic) receives messages. IOS app (even with changed name of topic) doesn't see messages from our webserver. Why ? Is it necessary to correct something on webserver or it is possible to correct B4i code ?
 

Brandsum

Well-Known Member
Licensed User
If you are using post method to send notification data to FCM server then this following structure is needed for iOS,
PHP:
$fcmNotification = [
    'priority'=>'high',
    "content_available"=> true,
    "mutable_content"=> true, //if you want to modify notification layout
    'to' => '/topics/ios_topic',
    "notification" => array(
      "body" =>  "Body text",
      "title" => "Title Text",
      "subtitle" => "Sub title text",
      'sound' => 'default',
      'badge' => '0'
     )
];

I use this structure to send a notification to iOS using FCM server.
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
Probably the reason is in API-key

If to open Firebase Console, I see short key "AIza..." in General settings. I am almost sure that our webserver uses exactly it.

But this key does not work with "Sending tool". It works with very long key in "Cloud Messaging".

I am afraid that it's necessary to expand webserver code and to send one message for Android app and another for IOS. Not a problem, but the server is enough busy.
 
Upvote 0
Top