on 03-25-2019 7:06 AM
Hi all,
I am developing notification function for Android device.
The following code is handling notification payload from Firebase and was generated by wizard.
However, when the app is running in background and notification payload has property "sound", for example:
{"alert":"Dear Customer", "data":"Notification", "sound":"default"}, the above method onReceive( ) won't be invoked.
I can still see a notification but only with app name, without alert and app icon, and this is different from a normal notification. Currently, I have to remove the property "sound" and it's working.
Anyone knows anything about this?
Regards,
Ming
Yes, that is correct the JSO send is to the mobile services. If you send the JSON I suggested above to the same URL(endpoint), it will send a data message to the device.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here it looks like the server is sending the notification as Notification-Message. The notification should be a Data-Notification. (Ref https://firebase.google.com/docs/cloud-messaging/concept-options )
To send a Data notification, please use the format below.
{
"alert": "TravelAgencies",
"data": "{\"message\": \"Notification to all devices registered to application\", \"sound\": \"default\"}"
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think the JSON string is sent to mobile service platform, which maybe different from Firebase.
Currently, the URL I post was:
lv_url = 'https://xxx.hanatrial.ondemand.com/restnotification/registration/d479ae156dd42f921fda7edbbfe81a34'.
lv_url = 'https://xxx.hanatrial.ondemand.com/restnotification/application/com.sap.ming13/user'.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.