Type Library Revision Release 2024.3703 Keywords notification, notifications Platforms Android, iOS
Gives access to local and push notifications.
This documentation outlines the legacy notifications plugin, primarily intended for Android apps which have been configured for
For new iOS apps, or existing iOS apps being updated with notifications for the first time, you should also implement the current Notifications plugin.
local notifications = require( "plugin.notifications" )
To use this plugin, add an entry into the plugins
table of build.settings
. When added, the build server will integrate the plugin during the build phase.
settings = { plugins = { ["plugin.notifications"] = { publisherId = "com.coronalabs" }, }, }
If your app is for Android and you intend to use GCM push notifications, you will also need to include the following plugin. However, if you only intend to use local notifications, this plugin should be omitted.
settings = { plugins = { ["shared.google.play.services.gcm"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, }, }
Additionally, add a notification
table to your config.lua
file as follows. When you registered with the GCM service, you should have received the projectNumber
value needed for the google
table.
application = { notification = { google = { projectNumber = "YOUR_PROJECT_NUMBER" }, } }
If you’re using Solar2D Native for iOS, you’ll need to add a reference to the CoronaNotificationsDelegate
in your Info.plist
as follows:
Add an entry to your Info.plist
called CoronaDelegates
and make it of type Array
.
Add an entry to the CoronaDelegates
array and call it CoronaNotificationsDelegate
. Ensure this is of type String
.