25 April 2017
Notifications “v2” plugin available
Corona Labs is pleased to announce the release of the new Notifications plugin which supports local notifications and push notifications driven by Google Firebase Cloud Messaging (FCM). Using this plugin, both iOS and Android apps can take advantage of FCM. While Google is maintaining their legacy Google Cloud Messaging (GCM) system for existing Android apps, all Android apps adding push notifications for the first time must now use FCM along with the new Notifications plugin.
This plugin is designed to be a drop-in replacement for the existing plugin.notifications
plugin.
Feature notes
The new plugin has some important new features that you should be aware of:
- With this new FCM-based Notifications plugin, iOS developers now have a choice. You can continue using the Apple Push Notification Service (APNS), just like the former plugin, or you can set up FCM to be a central service for push notifications. If you prefer the former (APNS), simply call notifications.registerForPushNotifications() with no parameters. If you prefer FCM, call the same API but also pass a table with the
useFCM
key set totrue
:
notifications.registerForPushNotifications( { useFCM=true } )
Then, outside the scope of Corona, you can set up FCM in your Google Developer portal with your Apple Push Notification certificates to handle sending push notifications from a single service. - This new plugin contains two new APIs called notifications.subscribe() and notifications.unsubscribe() that will let you subscribe users to various categories like “news”, “traffic”, “weather,” etc. These only work with FCM.
Usage
In your project, to use the new plugin, update your build.settings
to load the new plugin and, in your Lua files, require plugin.notifications.v2
instead of plugin.notifications
. Beyond that, your existing code should work as expected.
If you have any further questions, please consult the documentation and the Local/Push Notifications guide to learn how to implement notifications within your Corona app.
Sorry, the comment form is closed at this time.