hansemannn / titanium-firebase-cloud-messaging

Use the Firebase Cloud Messaging SDK in Axway Titanium 🚀 Edit
Other
43 stars 31 forks source link

Display of Android Background notification with Data (node) only payload #27

Closed fahad86 closed 6 years ago

fahad86 commented 6 years ago

Need more documentation on how to display (and customize) notifications with data node only, e.g.: 'data' => array( "test1" => "value1", "test2" => "value2", "timestamp"=>date('Y-m-d G:i:s'), "title" => "title", "message" => "message", "big_text"=>"big text even more text big text even more text big text even more text big text even more text big text even more text big text even more text big text even more text big text even more text big text even more text big text even more text big text even more text big text even more text big text even more text big text even more text ", "big_text_summary"=>"big_text_summary", "icon" => "http://via.placeholder.com/150x150", "image" => "http://via.placeholder.com/350x150", // won't show the big_text "force_show_in_foreground"=> true, "color" => "#ff6600" )

Right now when the app is in the background, with the above payload being sent, we only get a toast message saying "message"

m1ga commented 6 years ago

The module itself is not generating a Toast message. If you send this message it should generate a notification like this: https://github.com/hansemannn/titanium-firebase-cloud-messaging/blob/master/example/android_big_text.png If you set the "image" it won't show the big_text. Make sure you have the latest version and show us some code how you've implemented the module itself

fahad86 commented 6 years ago

I am using the latest version of the modules (Android: firebase.core 3.0.0, firebase.coremessaging 1.3.0).

    Alloy.Globals.fcm.addEventListener('didRefreshRegistrationToken', eventSuccess);
    Alloy.Globals.fcm.addEventListener('didReceiveMessage', function (event) {
      if (event.message && event.message.data) {
        onForegroundNotificationCallback(event.message.data);
      }
    });
    Alloy.Globals.fcm.registerForPushNotifications();
    if (!_.isEmpty(Alloy.Globals.fcm.lastData)) {
      onBackgroundNotificationClickedCallback(Alloy.Globals.fcm.lastData);
    }

I don't create/use any categories at the moment.

Do we need categories for achieving this?

hansemannn commented 6 years ago

Yes. Please use Stackoverflow or TiSlack to ask questions. This is no module issue, so I close this one.

fahad86 commented 6 years ago

FYI, (I didn't make myself clear before) this issue was about what this pull-request: https://github.com/hansemannn/titanium-firebase-cloud-messaging/pull/36 resolves :)

For the moment I'm just using notification messages. Waiting for the pull request to be merged :)