Page 1 of 1

Push notification text in the status bar

Posted: Sun Sep 09, 2012 8:32 am
by giovanni_c
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!

Re: Push notification text in the status bar

Posted: Tue Oct 02, 2012 11:25 am
by Bernard
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

Re: Push notification text in the status bar

Posted: Wed Oct 03, 2012 9:43 am
by Bernard
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

Re: Push notification text in the status bar

Posted: Tue Jan 01, 2013 9:03 pm
by giovanni_c
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.
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
Thank you Bernard! Your answer did the trick for me!!!
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

Posted: Tue Aug 06, 2013 6:36 pm
by ddupont
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. :D

Thank you Splash21! :D

Re: Push notification text in the status bar

Posted: Fri Nov 08, 2013 12:59 pm
by giovanni_c
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!

Re: Push notification text in the status bar

Posted: Sun Sep 06, 2015 7:13 pm
by sphere
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.

Re: Push notification text in the status bar

Posted: Mon Sep 21, 2015 12:52 pm
by sphere
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.

Re: Push notification text in the status bar

Posted: Tue Sep 01, 2020 5:21 pm
by MWCoastMedia
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.

Re: Push notification text in the status bar

Posted: Tue Sep 01, 2020 6:19 pm
by sphere
yes it has to be white with alpha.

Previous color was allowed, but after some date it was changed.