Mobile OneSignal

The Mobile OneSignal plugin is specifically designed to implement native mobile push notifications, post notifications and in-app messages features through the OneSignal Android SDK and OneSignal iOS SDK in both Android and iOS, for games built using Construct 3.


The OneSignal service has lots of features and tools, and the Mobile OneSignal plugin has integrated all of the features in both the OneSignal Android SDK and OneSignal iOS SDK.


The OneSignal service is a free service, although you can still opt for paid plans with additional benefits.

PlayFab API v2.png

Introduction

Step 1.png

The Construct Master Collection supports the full and easy integration of native mobile Android SDKs and iOS SDKs for both Construct 3 and Construct 2.


Please click here to learn more about Mobile.

Features


The Mobile OneSignal plugin is specifically designed to implement native mobile push notifications, post notifications and in-app messages features through the OneSignal Android SDK and OneSignal iOS SDK in both Android and iOS, for games built using Construct 3.


The OneSignal service has lots of features and tools, and the Mobile OneSignal plugin has integrated all of the features in both the OneSignal Android SDK and OneSignal iOS SDK.


The OneSignal service is a free service, although you can still opt for paid plans with additional benefits.


Here are some of the native features of the mobile plugin:

  • OneSignal service integration

  • OneSignal Android SDK

  • OneSignal iOS SDK

  • Full OneSignal API integration

  • Push notifications

  • Post notifications

  • In-app messages

  • GDPR

  • Consent dialog

  • iOS permission prompt

  • Tags

  • Triggers

  • External User Id

  • Appreances

  • Styles

  • Vibration features

  • Sound features

  • Email features

  • Location features

  • OneSignal is a free service, although you can still opt for paid plans with additional benefits.

  • Well maintained and fully tested for production release.


For more information about native mobile or Android and iOS features, please click here to learn the introductory lessons to Mobile.


Platform Integration


Here are some of the platforms that are natively supported:

  • Android

  • iOS

  • Native Android

  • Native iOS


Build Support


Here are some of the supported build options:


Editor Features


Here are some of the features in the Construct editor:

  • Construct 3

 
 

How to use?

It is easy to use the Mobile OneSignal plugin, you will only need to follow the steps below.

1. The first step is to add the Mobile OneSignal object into the project.


2. The next step is to create your own OneSignal account.


3. After creating your OneSignal account, create an application and then you will be required some credentials.



4. From your Construct 3 project, select the Mobile OneSignal object and then look over the Properties Bar.


5. Input your OneSignal App ID into the App ID field in the configuration section. Click to visit the instructions guide page.


6. By default, the rest of the property configurations in the Mobile OneSignal plugin upon adding should be ready for release and production. Unless you know what you are doing, please do not change any settings aside from the App ID field.


7. Build your application through any of the build options, then start sending native mobile push notifications, and other OneSignal SDK features.

 
 

Documentation

The Mobile OneSignal plugin is specifically designed to implement native mobile push notifications, post notifications and in-app messages features through the OneSignal Android SDK and OneSignal iOS SDK in both Android and iOS, for games built using Construct 3.


 

Actions, Conditions & Expressions

Actions

press to zoom

press to zoom

press to zoom

press to zoom
1/4

The following action groups:

  • Privacy

  • iOS

  • Status

  • Tags

  • Tags : Batched

  • Data

  • Sending Notifications

  • In-App Messaging : Trigger

  • In-App Messaging : Trigger : Batched

  • In-App : MISC

  • Email

  • External IDs

  • Android

Privacy

  • Provide User Consent - If your application is set to require the user's privacy consent, you can provide this consent using this method. Until enabled, the OneSignal will not fully initialize.

  • Consent - Check to acknowledge that the user has provided consent.


  • Check If User Provided Consent - Checks if the user has already provided privacy consent. Triggers 'On Check If User Provided Consent' and toggles with the 'Is Consent Provided'.

iOS

  • Prompt For Push Notifications Permission - Prompt the user for notification permissions. Only works if you set 'kOSSettingsKeyAutoPrompt' to 'false'. You can only prompt once, so make sure to specify the benefits.


Status

  • Get Permission Subscription State - Get the current notification and permission state.


Tags

  • Get Tags - Retrieve a list of tags that have been set on the user from the OneSignal server.


  • Send Tag - Tag a user based on an app event of your choosing so later you can create segments in Segments to target these users.

  • Key - Key of your choosing to create or update.

  • Value - Value to set on the key. NOTE: Passing in a blank String deletes the key, you can also call 'Delete Tag' or 'Delete Tags'.


  • Delete Tag - Deletes a single tag that was previously set on a user with "Send Tag" or "Send Tags".

  • Key - Key to remove.


Tags : Batched

  • Send Tags - Tag a user based on an app event of your choosing so later you can create segments in Segments to target these users. List collected from previously set plans.


  • Delete Tags - Deletes one or more tags that were previously set on a user with "Send Tag" or "Send Tags". List collected from previously set plans.


  • Plan Send Tag - Plan a tag to add to the next 'Send Tags' action.

  • Key - Key of your choosing to create or update.

  • Value - Value to set on the key. NOTE: Passing in a blank String deletes the key, you can also call 'Delete Tag' or 'Delete Tags'.


  • Plan Delete Tag - Plan to add a tag for removal on the next 'Delete Tags' action.

  • Key - Key to remove.


Data

  • Prompt Location - Prompts the user for location permissions. This allows for geotagging so you can send notifications to users based on location.


Sending Notifications


  • Clear Notifications - Clears all notifications in the Notification Center aka Shade sent from OneSignal.


  • Set Subscription - You can call this method with 'False' to opt users out of receiving all notifications through OneSignal. You can pass 'True' later to opt users back into notifications.This unsubscribes the user from OneSignal, but the device will still show as subscribed to push.

  • Toggle - Check to toggle 'True', uncheck to toggle 'False'.


In-App Messaging : Trigger

  • Add Trigger - Add a trigger, may show an In-App Message if its triggers conditions were met.

  • Key - Key for the trigger.

  • Value - Value for the trigger.


  • Remove Trigger - Removes a single trigger for the given key, may show an In-App Message if its triggers conditions were met.

  • Key - Key for trigger to remove.


  • Get Trigger Value - Gets a trigger value for a provided trigger key.

  • Key - Key for the trigger.


In-App Messaging : Trigger : Batched

  • Add Triggers - Add a key-value Object of triggers, may show an In-App Message if its triggers conditions were met. List collected from previously set plans.


  • Remove Triggers - Removes a list of triggers based on a collection of keys, may show an In-App Message if its triggers conditions were met. List collected from previously set plans.


  • Plan Add Trigger - Plan a trigger to add to the next 'Add Triggers' action.

  • Key - Key for the trigger.

  • Value - Value for the trigger.


  • Plan Remove Trigger - Plan to add a trigger for removal on the next 'Remove Triggers' action.

  • Key - Key for trigger to remove.


In-App - MISC

  • Pause In-App Messages - Allows you to temporarily pause all In-App Messages. You may want to do this while the user is watching a video playing a match in your game to make sure they don't get interrupted at a bad time.

  • Toggle - To pause set to 'true'. And to resume, set to 'false'.


Email

  • Set Email - This allows you to set the user's email address with the OneSignal SDK.

  • Email Address - The email address of the user. Make sure it's verified and without duplication.

  • Email Auth Token - Auth Token from your backend server.


  • Logout Email - If your app implements logout functionality, you can call this to dissociate the email from the device.


External-IDs

  • Set External User ID - If your system assigns unique identifiers to users, it can be annoying to have to also remember their OneSignal user ID's as well. To make things easier, OneSignal now allows you to set an 'external_id' for your users. Simply call this method, pass in your custom user ID (as a string), and from now on when you send a push notification, you can use 'include_external_user_ids' instead of 'include_player_ids'.

  • UserID - UserID provided by your backend server. Example, the user's PlayFabID.


  • Remove External User ID - UserID provided by your backend server. Example, the user's PlayFabID.


Android

  • Enable Vibrate - By default OneSignal always vibrates the device when a notification is displayed unless the device is in a total silent mode. Passing 'false' means that the device will only vibrate lightly when the device is in it's vibrate only mode.

  • Toggle - Set 'False' to disable vibrate, 'True' to re-enable it.


  • Enable Sound - By default OneSignal plays the system's default notification sound when the device's notification system volume is turned on. You may also set 'custom sounds' on notifications. Passing 'False' means that the device will only vibrate unless the device is set to a total silent mode.

  • Toggle - Set 'False' to disable sound, 'True' to re-enable it.

Conditions

The following condition groups:

  • Privacy

  • iOS

  • Status

  • Tags

  • Sending Notifications

  • In-App Messaging : Trigger

  • In-App : MISC

  • Email

  • Notification

  • Status : Observer

  • Email : Status

press to zoom

press to zoom

press to zoom

press to zoom
1/3

Privacy

  • Is Consent Provided - Checks if the user has given privacy consent.


  • On Check If User Provided Consent - Callback conditional trigger for the action 'Check If User Provided Consent'.



iOS

  • On Prompt Push Notification Permission - Trigger fires as soon as the user accepts or declines notifications from the iOS notification permission prompt.

  • Response - The user's response from the permission prompt. Either "Accepted" or "Rejected".


Status

  • On Get Permission Subscription State - Callback conditional trigger for the 'Get Permission Subscription State' action.


Tags

  • On Get Tags - Triggers if the 'Get Tags' action has completed.


Sending Notifications

  • On Post Notification Success - Trigger fires when the notification was created on OneSignal's server.


  • On Post Notification Failure - Trigger fires if the post notification fails.


In-App Messaging : Trigger

  • On Get Trigger Value - Trigger fires when the 'Get Trigger Value' action is completed.

  • Key - The trigger key.


In-App - MISC

  • On In-App Message Clicked - Trigger fires when an In-App Message is tapped on.


Email

  • On Set Email Success - Trigger fires when the 'Set Email' action succeeds.


  • On Set Email Failure - Trigger fires when the 'Set Email' action failed.


  • On Logout Email Success - Trigger fires when the 'Logout Email' action succeeds.


  • On Logout Email Failure - Trigger fires when the 'Logout Email' action failed.


Notification

  • On Notification Received - Triggers if the app is running in the foreground at the time the notification was received.


  • On Notification Opened - Triggers when a notification is tapped on from the notification shade (ANDROID) or notification center (iOS), or when closing an Alert notification shown in the app (if InAppAlert is enabled in InFocusDisplaying).


Status : Observer

  • On Subscription Status Changed - Triggers if the subscription status changes.


  • On Permission Status Changed - Triggers if the permission status changes.


Email : Status

  • On Email Status Changed - Trigger fires when the email subscription observer to track changes to email subscriptions (ie. the user sets their email or logs out), detects a change.

Expressions

press to zoom

press to zoom

press to zoom
1/2

The following expression groups:

  • Status

  • Tags

  • Sending Notifications

  • In-App Messaging : Trigger

  • In-App : MISC

  • Status : Observer

  • Email : Status

  • Status : Subscription Status

  • Status : Permission Status

  • Receiving Notifications

Status

  • SubscriptionStatus - Returns the current notification state, in JSON string.


  • PermissionStatus - Returns the current permission state, in JSON string.



Tags

  • Tags - Retrieves the JSON string list of tags, if the 'On Get Tags' condition, triggers.


Sending Notifications

  • PostNotificationData - Returns the post notification data, in JSON string.


In-App Messaging : Trigger

  • TriggerValue - Returns a single trigger value for the given key, if it exists, otherwise returns an empty string.


In-App - MISC

  • FirstClick - Returns 'True' if this is the first time the user has pressed any action on the In App Message, otherwise 'False'.


  • ClosesMessage - Did the action close the In App Message. Returns 'True' if the In App Message will animate off the screen, otherwise 'False' if the In App Message will stay on screen until the user dismisses.


  • ClickURL - Returns an optional URL that opens when the action takes place. Only present if set through the dashboard.


  • ClickName - An optional click name defined for the action element. Only present if set through the dashboard.


Status : Observer

  • ObserverSubscriptionStatus - Returns the subscription status observer data, in JSON string.


  • ObserverPermissionStatus - Returns the permission status observer data, in JSON string.


Email : Status

  • NewEmail - Returns the new email address detected by the 'Email Subscription Status Observer'.


  • NewUserID - Returns the new user id detected by the 'Email Subscription Status Observer'.


  • OldEmail - Returns the old email used before a change was detected by the 'Email Subscription Status Observer'.


  • OldUserID - Returns the old userid used before a change was detected by the 'Email Subscription Status Observer'.


Status : Subscription Status

  • Subscribed - "True" if subscribed to push notifications, otherwise "False".


  • UserSubscriptionSetting - Reflects value of "Set Subscription". Defaults to "True".


  • UserID - The OneSignal Player ID.


  • PushToken - Device Identifier from FCM/APNs.


Status : Permission Status

  • Status - 0 = Not Determined, 1 = Denied and 2 = Authorized.


  • State - 1 = Authorized and 2 = Denied.


  • HasPrompted - "False" = Not prompted and "True" = Prompted.


  • Provisional - Either "True" or "False". iOS only : Provisional notifications are non-interruptive notifications and can be turned on in the iOS Settings.


Receiving Notifications

  • NotificationReceivedData - Returns the received notification's data, in JSON string.


  • NotificationOpenedData - Returns the opened notification's data, in JSON string.

Object   Properties

Plugin Properties

press to zoom

press to zoom
1/1

The following property groups:

  • Configuration

  • Initialization

  • iOS Initialization

  • Privacy

  • Status

  • Data

  • Email

Configuration - The general settings to apply to the Mobile OneSignal.

  • Debug Mode - Enable to log info and error messages into the Developer Tools : Console.


  • App ID - Your OneSignal application id (app id).

Initialization - The settings required to setup before starting the OneSignal service.

  • In-Focus-Displaying - Default: InAppAlert - native alert dialog display, which can be helpful during development (note this is not an In-App Message).; Notification - native notification display while user has app in focus (can be distracting).; None - notification is silent.

  • Notification

  • In-App-Alert

  • None



iOS Initialization - Initialization for iOS.

  • kOSSettingsKeyAutoPrompt - Auto prompt user for notification permissions.


  • kOSSettingsKeyInAppLaunchURL - Used with the Launch URL you set on push notifications. 'True' will open the Launch URL in an in-app browser and 'False' will open the Launch URL in the device's default browser.


  • Debug - The debugging configuration section for OneSignal.

  • Log Level - Sets the logging level to print to the iOS Xcode log or the Android LogCat log.

  • 0 = NONE

  • 1 = FATAL

  • 2 = ERROR

  • 3 = WARN

  • 4 = INFO

  • 5 = DEBUG

  • 6 = VERBOSE

  • Visual Level - Sets the logging level to show as alert dialogs.

  • 0 = NONE

  • 1 = FATAL

  • 2 = ERROR

  • 3 = WARN

  • 4 = INFO

  • 5 = DEBUG

  • 6 = VERBOSE


Privacy - The privacy settings for the users.

  • Requires User Privacy Consent - Allows you to delay the initialization of the SDK until the user provides privacy consent through the 'Provide User Consent = True' action.

Status - The state of the notification subscriptions and permissions.

  • Permission Status : Observer - If on "Auto-Update", the notification permission status is automatically updated when the observer detects a change.

  • Manual

  • Auto-Update


  • Subscription Status : Observer - If on "Auto-Update", the notification subscription status is automatically updated when the observer detects a change.

  • Manual

  • Auto-Update


Data - Configuration for the user's data.

  • Set Location Shared - Disable or enable location collection (defaults to enabled if your app has location permission).

Email - User email configuration section.

  • Email Status Observer - Email subscription observer to track changes to email subscriptions (ie. the user sets their email or logs out).

  • Manual

  • Auto-Update

 
 

Showcase