Push notification text in the status bar
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 52
- Joined: Sat Sep 08, 2012 10:50 am
Push notification text in the status bar
Hi all.
As in subject: there's a way to customize / change the notification text in the Android status bar?
I've tried to change the data array send but in the status bar I always see "Notification received"
(in english... and my device is in another language!)
I think push notification is a great tool to communicate with your app but right now I can't find
documentation to work with them.
Thank you to everyone can / want help me!
As in subject: there's a way to customize / change the notification text in the Android status bar?
I've tried to change the data array send but in the status bar I always see "Notification received"
(in english... and my device is in another language!)
I think push notification is a great tool to communicate with your app but right now I can't find
documentation to work with them.
Thank you to everyone can / want help me!
Re: Push notification text in the status bar
Hi Giovanni,
I've just started to look at Android development & notifications.
I found that the following data items (sent to the GCM api service) affect what is displayed in the status bar when a notification is received.
data.title is displayed to the right of the icon of the status bar
data.body is displayed beneath the icon+text of the status bar
I'm giving you the parameters as "data.xxxx" because I'm using plain-text (not JSON) to send the notification to the GCM api service. Maybe I will get round to using JSON soon. However, I'm sure your JSON array already contains a "data" key, so it is just a question of adding new elements named "title" & "body" in your own language, and that should work.
I've requested that Runrev update the Lesson for Push Notification, as a) the Android way is soooo much simpler than the iOS way, and b) that Lesson (for all its simplicity) is woefully out of date).
Bernard
I've just started to look at Android development & notifications.
I found that the following data items (sent to the GCM api service) affect what is displayed in the status bar when a notification is received.
data.title is displayed to the right of the icon of the status bar
data.body is displayed beneath the icon+text of the status bar
I'm giving you the parameters as "data.xxxx" because I'm using plain-text (not JSON) to send the notification to the GCM api service. Maybe I will get round to using JSON soon. However, I'm sure your JSON array already contains a "data" key, so it is just a question of adding new elements named "title" & "body" in your own language, and that should work.
I've requested that Runrev update the Lesson for Push Notification, as a) the Android way is soooo much simpler than the iOS way, and b) that Lesson (for all its simplicity) is woefully out of date).
Bernard
Re: Push notification text in the status bar
Giovanni, I'm wondering if there is a bug with the status bar/notifications and Livecode.
When a Notification turns up in the status bar (either Push or Local) I get no warning sound/no vibration. That's bad. But also, when I then go to my app (either by selecting the Notification, or by just going to the app), none of the message handlers are triggered (e.g. pushNotificationReceived) with the payload details that accompany the Notification.
Is this your experience too? I tried this with Push and Local Notifications, and tried it with two different (Android 2.2) devices. Nothing seems to make any difference.
I can't see that Notifications are really that useful if they cannot alert a user when the display of the device is asleep. And surely there must be something wrong if they payload is lost between the Status Bar and the App.
Bernard
When a Notification turns up in the status bar (either Push or Local) I get no warning sound/no vibration. That's bad. But also, when I then go to my app (either by selecting the Notification, or by just going to the app), none of the message handlers are triggered (e.g. pushNotificationReceived) with the payload details that accompany the Notification.
Is this your experience too? I tried this with Push and Local Notifications, and tried it with two different (Android 2.2) devices. Nothing seems to make any difference.
I can't see that Notifications are really that useful if they cannot alert a user when the display of the device is asleep. And surely there must be something wrong if they payload is lost between the Status Bar and the App.
Bernard
-
- Posts: 52
- Joined: Sat Sep 08, 2012 10:50 am
Re: Push notification text in the status bar
Hi all.
First of all I want to thank you for your replies and excuse me for the delay in my answer... I'm really sorry.
Using the "title" and "body" keys for the data array permit me to customize the notification alert in the way I want!
The notification is correctly received form me but, as you reported, no sound is played.
But the message handlers are correctly triggered for me and I can see the alert I call in "pushNotificationReceived" with the payload sent.
First of all I want to thank you for your replies and excuse me for the delay in my answer... I'm really sorry.
Thank you Bernard! Your answer did the trick for me!!!Bernard wrote: data.title is displayed to the right of the icon of the status bar
data.body is displayed beneath the icon+text of the status bar
Using the "title" and "body" keys for the data array permit me to customize the notification alert in the way I want!
The notification is correctly received form me but, as you reported, no sound is played.
But the message handlers are correctly triggered for me and I can see the alert I call in "pushNotificationReceived" with the payload sent.
Re: Push notification text in the status bar
Splash21 has posted a sender stack that works. There are parameters for sound that are not in the LC lesson. I have attached splash21's stack for sending push notifications as it is MUCH better than the LC lesson stack.
Thank you Splash21!
Thank you Splash21!
- Attachments
-
- AndroidGCM.zip
- Splash21 provided this stack, AndroidGCM
- (2.86 KiB) Downloaded 400 times
-
- Posts: 52
- Joined: Sat Sep 08, 2012 10:50 am
Re: Push notification text in the status bar
Hi ddupont!
I'm sorry for replying so late to your post.
Splash21's stack helped me to solve the Android Notification Sound problem!
Thank you very much for pointing me to the right direction!!!
I'm not using the JSON form for my data but simply post the data to the sending page and it worked flawlessly sending the parameter "data.play_sound=true"
Great thanks!
I'm sorry for replying so late to your post.
Splash21's stack helped me to solve the Android Notification Sound problem!
Thank you very much for pointing me to the right direction!!!
I'm not using the JSON form for my data but simply post the data to the sending page and it worked flawlessly sending the parameter "data.play_sound=true"
Great thanks!
Re: Push notification text in the status bar
I am glad i finally found this stack whoohoo!
First one that actually works! The lesson did not work for me and i tried dozens of examples from the web.
I always did get the push notification registration, and if i did a push via php script on my website to test i even got Succes:1 from the google server but never got an pushnotification on my rooted Galaxy Sii with Lollipop on it.
But this stack does work with my API and device token credentials.
May i thank you?
I think that's a yes.
Well thank you very much!!!
Now i'm going to check why this works and via my php scripts do not. I want to let it work via the php scripts so the stored device id's can be used.
But maybe i can do a work around. Get the id's from the database and send it direct form the livecode stack instead of sending the message to the php script.
First one that actually works! The lesson did not work for me and i tried dozens of examples from the web.
I always did get the push notification registration, and if i did a push via php script on my website to test i even got Succes:1 from the google server but never got an pushnotification on my rooted Galaxy Sii with Lollipop on it.
But this stack does work with my API and device token credentials.
May i thank you?
I think that's a yes.
Well thank you very much!!!
Now i'm going to check why this works and via my php scripts do not. I want to let it work via the php scripts so the stored device id's can be used.
But maybe i can do a work around. Get the id's from the database and send it direct form the livecode stack instead of sending the message to the php script.
Re: Push notification text in the status bar
It seems that in the client app. you have to set which icon will be shown or which sound will be played has to be set.
I noticed that if you do not and you use the androidgcm stack that the notification is received, because i hear the sound, but no notification is shown.
(i also noticed, in all different tests i did, that if you do not send all these things like badge, sound, etc it is not working)
edit---Probably my status bar icon was not findable while building the apk(but i did not get any fault message) once i re-selected the icon, it is now working as expected.
I love it. Sometimes it takes more time to get the puzzle solved.
I noticed that if you do not and you use the androidgcm stack that the notification is received, because i hear the sound, but no notification is shown.
(i also noticed, in all different tests i did, that if you do not send all these things like badge, sound, etc it is not working)
edit---Probably my status bar icon was not findable while building the apk(but i did not get any fault message) once i re-selected the icon, it is now working as expected.
I love it. Sometimes it takes more time to get the puzzle solved.
-
- Posts: 32
- Joined: Fri Jan 16, 2015 5:31 pm
Re: Push notification text in the status bar
I looked in the Standalone Application Settings Lesson for the specs of this icon, but couldn't find details @ http://lessons.livecode.com/m/4603/l/68 ... n-settings
It would appear this needs to be a 96x96 white PNG with alpha.
It would appear this needs to be a 96x96 white PNG with alpha.
Re: Push notification text in the status bar
yes it has to be white with alpha.
Previous color was allowed, but after some date it was changed.
Previous color was allowed, but after some date it was changed.