eja, I forgot to show you how to remove notifications from the status bar while your app is in the background… because our Lua API is not accessible while the app is suspended. You’ll need to use some more of our private Corona APIs to remove the notification if you want to consolidate them into one group.
// Create the interface to Corona's notification system. // Note that all of this object's methods are thread safe. com.ansca.corona.notifications.NotificationServices notificationServices; notificationServices = new com.ansca.corona.notifications.NotificationServices(context); // This method removes all local and remote notifications. // This even removes scheduled notifications that are not in the status bar yet. notificationServices.removeAll(); // If you don't want to remove scheduled notifications and notifications posted in // the status bar, then you need to do the following instead. for (com.ansca.corona.notifications.StatusBarNotificationSettings settings : notificationServices.fetchStatusBarNotifications()) { notificationServices.removeById(settings.getid()); }
Just be warned that the above is Corona’s private APIs and may change in the future… but odds are we won’t because we’re pretty satisfied with how it works. Also, if there is enough demand for it, we can work on making our Java notification classes/APIs public in the future. We coded it with that in mind since Android’s notification framework is quite extensible compared to iOS.
Oh, and another warning. If you post your own notification to the status bar via Google’s Android APIs, then you should know that Android will forget everything that was posted when restarting your application process or rebooting your device. It’s up to the app developer to restore notifications in the status bar. Typically by saving that information to file. Corona does this automatically with the notifications it posts, but only supports simple status bar notifications. Nothing is ever easy in the Android world, eh?
Anyways, I hope the above helps you out.