Gcm Launch Background/closed App When Get Notification (android)
I have a problem with GCM. I created a server side notification pusher (in PHP), that send to specific user (based on location) who have the app, a notification. I have three cla
Solution 1:
OK,
I just fixed the problem.
The JSON i send is like :
"notification":{
"body":"blabla",
"title":"one title""icon":"notification_icon"
},
"data":{
"body":"blabla",
"title":"one title"
},
"registration_ids":["id1", "id2", etc]
But this part (from the JSON) :
"notification":{
"body":"blabla",
"title":"one title""icon":"notification_icon"
}
was the problem.
I thought the JSONmessage is in two part, "data" when app is open, and "notification" when app is closed or in background.
I thought that, because the app is closed, how can android know that he must show a notification ? So it's why use "notification" for specify that android must show a notification.
But no, "notification" is used for send simple notification without action.
So i resolve the problem by sending this JSON :
"data":{
"body":"blabla",
"title":"one title"
},
"registration_ids":["id1", "id2", etc]
Post a Comment for "Gcm Launch Background/closed App When Get Notification (android)"