Push notifications

Great! I’m glad it’s working for your now! :slight_smile: [import]uid: 32256 topic_id: 31525 reply_id: 137955[/import]

@Josh: Currently, my C2DM messages are displayed on the Android phone screen with an icon that looks like an inverted triangle with an exclamation mark inside, whereas other apps display their own icon next to the push message.

As far as I understand, this icon must be set by the client. Does Corona support this? Where do I specify this icon?
[import]uid: 73434 topic_id: 31525 reply_id: 138578[/import]

its in this thread… scroll up [import]uid: 55582 topic_id: 31525 reply_id: 138581[/import]

Great! Hope all this information ends up in the official documentation soon so we’ll have one place to look!

Another thing: Our testers complain that the notifications in our Corona app flood the Android status menu (the notifications are not collapsed like in other apps). According to a guy on SE, this cannot be controlled from the server, it needs to be supported on the device. Would it be much work for Corona to support notification collapsing on the device?

http://stackoverflow.com/questions/3740103/how-to-collapse-android-notifications
[import]uid: 73434 topic_id: 31525 reply_id: 138685[/import]

I’ll bring it up, but a couple of thoughts. They talk about using C2DM, but our push notifications are implemented with GCM. I’m not sure how feature compatible they are. And from my experience (albeit the only non-Corona app that I have that sends multple push messages is the Facebook app and on my Google Nexus 7, I see quite a few little “f”'s in my status bar. So maybe collapsing is a C2DM feature but not a GCM feature. [import]uid: 199310 topic_id: 31525 reply_id: 138745[/import]

Olav,

There isn’t an Android OS feature which automatically collapses notifications in the status bar.

What some apps such as the gmail app do is only show 1 status bar notification, but they update its text and number when new notifications are received from the Internet. So the whole time, it only shows one notification in the status bar. This is pretty much the Android equivalent of showing an app badge number, but in the status bar. The Android OS doesn’t do this for you. The app has to manage this. Now, I’ve never seen an Android app collapse multiple notifications in the status bar into one before, but the only way an app could do this is to remove those notifications from the status bar and then replace it with one status bar notification with a number in its text.

What you are asking for is not a small/quick feature request. I can write it up as a feature request, but I would need more than on person asking for it to hold any weight over our current roadmap.

If you’re a Corona Enterprise user, then another solution would be for us to expose our notification handling Java classes. I was already considering making our Java API for notifications public in the coming months, but I could step up my plans to do so. Android notifications are much more powerful and have many more options than on iOS, so our Java code was written to be used by Enterprise developers to take advantage of them.

Or you could just not send your users too many notifications. Not trying to be critical, but I tend to disable all notifications from apps on my personal iPhone that bug me too much.
(Starbucks app… I’m looking at you.) [import]uid: 32256 topic_id: 31525 reply_id: 138889[/import]

Thanks for the clarification, and I agree with your assessment of the issue. Keep up the good work! [import]uid: 73434 topic_id: 31525 reply_id: 138959[/import]

@Josh: Currently, my C2DM messages are displayed on the Android phone screen with an icon that looks like an inverted triangle with an exclamation mark inside, whereas other apps display their own icon next to the push message.

As far as I understand, this icon must be set by the client. Does Corona support this? Where do I specify this icon?
[import]uid: 73434 topic_id: 31525 reply_id: 138578[/import]

its in this thread… scroll up [import]uid: 55582 topic_id: 31525 reply_id: 138581[/import]

Great! Hope all this information ends up in the official documentation soon so we’ll have one place to look!

Another thing: Our testers complain that the notifications in our Corona app flood the Android status menu (the notifications are not collapsed like in other apps). According to a guy on SE, this cannot be controlled from the server, it needs to be supported on the device. Would it be much work for Corona to support notification collapsing on the device?

http://stackoverflow.com/questions/3740103/how-to-collapse-android-notifications
[import]uid: 73434 topic_id: 31525 reply_id: 138685[/import]

I’ll bring it up, but a couple of thoughts. They talk about using C2DM, but our push notifications are implemented with GCM. I’m not sure how feature compatible they are. And from my experience (albeit the only non-Corona app that I have that sends multple push messages is the Facebook app and on my Google Nexus 7, I see quite a few little “f”'s in my status bar. So maybe collapsing is a C2DM feature but not a GCM feature. [import]uid: 199310 topic_id: 31525 reply_id: 138745[/import]

Olav,

There isn’t an Android OS feature which automatically collapses notifications in the status bar.

What some apps such as the gmail app do is only show 1 status bar notification, but they update its text and number when new notifications are received from the Internet. So the whole time, it only shows one notification in the status bar. This is pretty much the Android equivalent of showing an app badge number, but in the status bar. The Android OS doesn’t do this for you. The app has to manage this. Now, I’ve never seen an Android app collapse multiple notifications in the status bar into one before, but the only way an app could do this is to remove those notifications from the status bar and then replace it with one status bar notification with a number in its text.

What you are asking for is not a small/quick feature request. I can write it up as a feature request, but I would need more than on person asking for it to hold any weight over our current roadmap.

If you’re a Corona Enterprise user, then another solution would be for us to expose our notification handling Java classes. I was already considering making our Java API for notifications public in the coming months, but I could step up my plans to do so. Android notifications are much more powerful and have many more options than on iOS, so our Java code was written to be used by Enterprise developers to take advantage of them.

Or you could just not send your users too many notifications. Not trying to be critical, but I tend to disable all notifications from apps on my personal iPhone that bug me too much.
(Starbucks app… I’m looking at you.) [import]uid: 32256 topic_id: 31525 reply_id: 138889[/import]

Thanks for the clarification, and I agree with your assessment of the issue. Keep up the good work! [import]uid: 73434 topic_id: 31525 reply_id: 138959[/import]

Am I correct to understand that we do not have any simple way to control how many push notification icons show up on the status bar?  I mean, with iOS, I can use native.setProperty( “applicationIconBadgeNumber”, 0 ) to reset the badge number and remove it from the app icon.  Am I correct to understand that there is currently no such function for Android?

 

I send push notifications from remote server to individual Android device as needed, but I do not track notification ID for each and every notification that is being sent from the server.  Does this mean there’s no way for the app to remove notification icons that line up on the status bar until the users manually remove them?  It feels very wrong to see so many icons lining up.  If only we could remove them all from within the app…  Or only if there’s a simple way to show only one icon (without having to save each notification ID…) 

 

And if it’s not possible to remove already displaying status bar icons, can the app block them from being displayed while the app is in foreground?  I’d rather provide in-game custom notification in such case…

 

Naomi

Naomi,

 

You can remove all status bar notifications on android by calling the system.cancelNotification() with no arguments.  This will remove all push and local notifications.

Thank you so much, Joshua.  I don’t know why I failed to find that function.  For my push notification on Google Play Android device, I’ll include system.cancelNotification() inside the onNotification event listener (which would be called after the app shows some visual prompt for the user to learn about a notification event – and I hope that would do the job.)

 

Thanks again!

Naomi

Happy to help Naomi!

Just so you know, I’ve taken a quick look at this and have discovered that system.cancelNotification() only removes local/scheduled notifications on iOS.  It does not remove remote/push notifications on iOS like how it works on Android.  I’ve  written up a bug report on our end to make it behave as expected.

Reversely, I’ve written up a bug report for Android to have it clear all notifications if you set the application badge number to zero to match the iOS behavior.

That sounds great, Joshua.  Thank you so much for the follow up.

For now, I’m using native.setProperty to reset the badge number for iOS devices and system.cancelNotification for Android.  I haven’t seen issues with this so far.

Thanks again.

Naomi

Am I correct to understand that we do not have any simple way to control how many push notification icons show up on the status bar?  I mean, with iOS, I can use native.setProperty( “applicationIconBadgeNumber”, 0 ) to reset the badge number and remove it from the app icon.  Am I correct to understand that there is currently no such function for Android?

 

I send push notifications from remote server to individual Android device as needed, but I do not track notification ID for each and every notification that is being sent from the server.  Does this mean there’s no way for the app to remove notification icons that line up on the status bar until the users manually remove them?  It feels very wrong to see so many icons lining up.  If only we could remove them all from within the app…  Or only if there’s a simple way to show only one icon (without having to save each notification ID…) 

 

And if it’s not possible to remove already displaying status bar icons, can the app block them from being displayed while the app is in foreground?  I’d rather provide in-game custom notification in such case…

 

Naomi

Naomi,

 

You can remove all status bar notifications on android by calling the system.cancelNotification() with no arguments.  This will remove all push and local notifications.