1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

iOS Question Firebase Notifications

Discussion in 'iOS Questions' started by Semen Matusovskiy, Aug 14, 2019.

  1. Semen Matusovskiy

    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 ?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    If it is working with the B4J sending tool and it is not working with your web server then the problem is in the web server. This is all that I can say based on the information you provided.
     
    BillMeyer likes this.
  3. Brandsum

    Brandsum Active 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.
     
  4. Semen Matusovskiy

    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.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice