Packagecom.myflashlab.air.extensions.firebase.fcm
Classpublic class OneSignal
InheritanceOneSignal Inheritance Object



Public Properties
 PropertyDefined By
  inFocusDisplayType : int
[static] (Android + iOS) Setting to control how OneSignal notifications will be shown when one is received while your app is in focus, for apps targeting.
OneSignal
  listener : EventDispatcher
[static] [read-only]
OneSignal
  requiresUserPrivacyConsent : Boolean
[static] (Android + iOS) You can use this property to check if the OneSignal SDK is waiting for the user to provide privacy consent.
OneSignal
Public Methods
 MethodDefined By
  
cancelNotification($id:int):void
[static] Cancels a single OneSignal notification based on its Android notification integer id.
OneSignal
  
[static] Removes all OneSignal notifications from the Notification Shade.
OneSignal
  
consentGranted($granted:Boolean):void
[static] If you set the SDK to require the user's privacy consent, your application can use this method once the user does or doesn't provide privacy consent to use the OneSignal SDK.
OneSignal
  
deleteTag($key:String, $successCallback:Function = null, $failureCallback:Function = null):void
[static] Deletes a single tag that was previously set on a user with sendTag or sendTags.
OneSignal
  
deleteTags($keys:Array, $successCallback:Function = null, $failureCallback:Function = null):void
[static] Deletes one or more tags that were previously set on a user with sendTag or sendTags.
OneSignal
  
enableSound($enable:Boolean):void
[static] By default OneSignal plays the system's default notification sound when the device's notification system volume is turned on.
OneSignal
  
enableVibrate($enable:Boolean):void
[static] By default OneSignal always vibrates the device when a notification is displayed unless the device is in a total silent mode.
OneSignal
  
[static] Get the current notification and permission state.
OneSignal
  
getTags($callback:Function):void
[static] Retrieve a list of tags that have been set on the user from the OneSignal server.
OneSignal
  
init($settings:OneSignalInitSettings):void
[static]
OneSignal
  
logoutEmail($successCallback:Function = null, $failureCallback:Function = null):void
[static] If your app implements logout functionality, you can call logoutEmail to dissociate the email from the device
OneSignal
  
postNotification($params:Object, $successCallback:Function, $failureCallback:Function):void
[static] Allows you to send notifications from user to user or schedule ones in the future to be delivered to the current device.
OneSignal
  
[static] presents the settings page to control/customize push notification settings
OneSignal
  
promptForPushNotifications($callback:Function = null):void
[static] (iOS) Prompt the user for notification permissions.
OneSignal
  
[static] Prompts the user for location permissions to allow geo-tagging from the OneSignal dashboard.
OneSignal
  
[static] deprecated, use FCM.registerChannel instead.
OneSignal
  
registerForProvisionalAuthorization($callback:Function = null):void
[static] (iOS) supported on iOS 12+
OneSignal
  
sendTag($key:String, $value:String):void
[static] Tag a user based on an app event of your choosing so later you can create segments on onesignal.com to target these users.
OneSignal
  
sendTags($keyValues:Object, $successCallback:Function = null, $failureCallback:Function = null):void
[static] Tag a user based on an app event of your choosing so later you can create segments on onesignal.com to target these users.
OneSignal
  
setEmail($email:String, $hashToken:String = null, $successCallback:Function = null, $failureCallback:Function = null):void
[static] setEmail allows you to set the user's email address with the OneSignal SDK.
OneSignal
  
setExternalUserId($userID:String):void
[static] If your system assigns unique identifiers to users, it can be annoying to have to also remember their OneSignal user ID's as well.
OneSignal
  
setlocationshared($enabled:Boolean):void
[static] Allows you to enable or disable OneSignal SDK location collection.
OneSignal
  
setLogLevel($logLevel:int, $visualLevel:int):void
[static] Enable logging to help debug if you run into an issue setting up OneSignal.
OneSignal
  
setSubscription($enabled:Boolean):void
[static] You can call this method with false to opt users out of receiving all notifications through OneSignal.
OneSignal
Public Constants
 ConstantDefined By
  ANDROID_SDK_VERSION : String = 3.13.0
[static]
OneSignal
  IOS_SDK_VERSION : String = 2.10.0
[static]
OneSignal
Property Detail
inFocusDisplayTypeproperty
inFocusDisplayType:int

(Android + iOS) Setting to control how OneSignal notifications will be shown when one is received while your app is in focus, for apps targeting.


Implementation
    public static function get inFocusDisplayType():int
    public static function set inFocusDisplayType(value:int):void
listenerproperty 
listener:EventDispatcher  [read-only]


Implementation
    public static function get listener():EventDispatcher
requiresUserPrivacyConsentproperty 
requiresUserPrivacyConsent:Boolean

(Android + iOS) You can use this property to check if the OneSignal SDK is waiting for the user to provide privacy consent.

For GDPR users, your application should call this method before initialization of the SDK. If you pass in true, your application will need to call provideConsent(true) before the OneSignal SDK gets fully initialized. Until this happens, you can continue to call methods (such as sendTags()), but nothing will happen.


Implementation
    public static function get requiresUserPrivacyConsent():Boolean
    public static function set requiresUserPrivacyConsent(value:Boolean):void
Method Detail
cancelNotification()method
public static function cancelNotification($id:int):void

Cancels a single OneSignal notification based on its Android notification integer id. Use instead of Android's NotificationManager.cancel(id); otherwise the notification will be restored when your app is restarted.

Parameters

$id:int

clearOneSignalNotifications()method 
public static function clearOneSignalNotifications():void

Removes all OneSignal notifications from the Notification Shade. If you just use NotificationManager.cancelAll(); OneSignal notifications will be restored your app is restarted.

consentGranted()method 
public static function consentGranted($granted:Boolean):void

If you set the SDK to require the user's privacy consent, your application can use this method once the user does or doesn't provide privacy consent to use the OneSignal SDK.

Parameters

$granted:Boolean

deleteTag()method 
public static function deleteTag($key:String, $successCallback:Function = null, $failureCallback:Function = null):void

Deletes a single tag that was previously set on a user with sendTag or sendTags. Use deleteTags if you need to delete more than one.

Parameters

$key:String — Key to remove
 
$successCallback:Function (default = null) — Call if there were no errors. function($msg:String)
 
$failureCallback:Function (default = null) — Called if there was an error. function($error:String)

deleteTags()method 
public static function deleteTags($keys:Array, $successCallback:Function = null, $failureCallback:Function = null):void

Deletes one or more tags that were previously set on a user with sendTag or sendTags.

Parameters

$keys:Array — Keys to remove
 
$successCallback:Function (default = null) — Call if there were no errors. function($msg:String)
 
$failureCallback:Function (default = null) — Called if there was an error. function($error:String)

enableSound()method 
public static function enableSound($enable:Boolean):void

By default OneSignal plays the system's default notification sound when the device's notification system volume is turned on. Passing false means that the device will only vibrate unless the device is set to a total silent mode.

You can link this action to a UI button to give your user a different sound option for your notifications.

Parameters

$enable:Boolean — If true(default) - Sound plays when receiving notification. Vibrates when device is on vibrate only mode. If false - Only vibrates unless enableVibrate(false) was set.

enableVibrate()method 
public static function enableVibrate($enable:Boolean):void

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.

You can link this action to a UI button to give your user a vibration option for your notifications.

Parameters

$enable:Boolean — If true(default) - Device will always vibrate unless the device is in silent mode. If false - Device will only vibrate when the device is set on it's vibrate only mode.

getPermissionSubscriptionState()method 
public static function getPermissionSubscriptionState():String

Get the current notification and permission state.

Returns
String
getTags()method 
public static function getTags($callback:Function):void

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

Parameters

$callback:Function — Called when tags are received from OneSignal's server. function($msg:String)

init()method 
public static function init($settings:OneSignalInitSettings):void

Parameters

$settings:OneSignalInitSettings

logoutEmail()method 
public static function logoutEmail($successCallback:Function = null, $failureCallback:Function = null):void

If your app implements logout functionality, you can call logoutEmail to dissociate the email from the device

Parameters

$successCallback:Function (default = null)
 
$failureCallback:Function (default = null)

postNotification()method 
public static function postNotification($params:Object, $successCallback:Function, $failureCallback:Function):void

Allows you to send notifications from user to user or schedule ones in the future to be delivered to the current device.

See the Create notification REST API POST, https://documentation.onesignal.com/reference-link/create-notification call for a list of all possible options. Note: You can only use include_player_ids as a targeting parameter from your app. Other target options such as tags and included_segments require your OneSignal App REST API key which can only be used from your server.

Parameters

$params:Object — Dictionary of notification options.
 
$successCallback:Function — Called if there were no errors sending the notification
 
$failureCallback:Function — Called if there was an error

presentAppSettings()method 
public static function presentAppSettings():void

presents the settings page to control/customize push notification settings

promptForPushNotifications()method 
public static function promptForPushNotifications($callback:Function = null):void

(iOS) Prompt the user for notification permissions. Callback fires as soon as the user accepts or declines notifications.

must have set settings.autoPrompt = false; when calling OneSignal.init(settings);

IOS Recommendations: You can only prompt once so it is recommend to explain what benefits notifications will give the user.

Parameters

$callback:Function (default = null)

promptLocation()method 
public static function promptLocation():void

Prompts the user for location permissions to allow geo-tagging from the OneSignal dashboard. This lets you send notifications based on the device's location.

Note: Requires the follow entries in your .plist file.

Optional

Example plist image: https://i.imgur.com/OZDQpyQ.png

registerChannel()method 
public static function registerChannel($channel:NotificationChannel):void

deprecated, use FCM.registerChannel instead.

Parameters

$channel:NotificationChannel

registerForProvisionalAuthorization()method 
public static function registerForProvisionalAuthorization($callback:Function = null):void

(iOS) supported on iOS 12+

Parameters

$callback:Function (default = null)

sendTag()method 
public static function sendTag($key:String, $value:String):void

Tag a user based on an app event of your choosing so later you can create segments on onesignal.com to target these users. Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.

Parameters

$key:String — Key of your choosing to create or update
 
$value:String — Value to set on the key. NOTE: Passing in a blank String deletes the key, you can also call deleteTag or deleteTags.

sendTags()method 
public static function sendTags($keyValues:Object, $successCallback:Function = null, $failureCallback:Function = null):void

Tag a user based on an app event of your choosing so later you can create segments on onesignal.com to target these users.

Parameters

$keyValues:Object — Key value pairs of your choosing to create or update. NOTE: Passing in a blank String as a value deletes the key, you can also call deleteTag or deleteTags.
 
$successCallback:Function (default = null)
 
$failureCallback:Function (default = null)

setEmail()method 
public static function setEmail($email:String, $hashToken:String = null, $successCallback:Function = null, $failureCallback:Function = null):void

setEmail allows you to set the user's email address with the OneSignal SDK. If you have a backend server, we strongly recommend using Identity Verification with your users. Your backend can generate an email authentication token and send it to your app.

Parameters

$email:String
 
$hashToken:String (default = null)
 
$successCallback:Function (default = null)
 
$failureCallback:Function (default = null)

setExternalUserId()method 
public static function setExternalUserId($userID:String):void

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.

Parameters

$userID:String

setlocationshared()method 
public static function setlocationshared($enabled:Boolean):void

Allows you to enable or disable OneSignal SDK location collection. Due to Apple's App Store Guidelines, it is required in iOS applications to get the user's consent before collecting location.

Parameters

$enabled:Boolean

setLogLevel()method 
public static function setLogLevel($logLevel:int, $visualLevel:int):void

Enable logging to help debug if you run into an issue setting up OneSignal. This selector is static so you can call it before OneSignal init. The following options are available with increasingly more information;

Parameters

$logLevel:int — Sets the logging level to print to the Xcode log
 
$visualLevel:int — Sets the logging level to show as alert dialogs.

setSubscription()method 
public static function setSubscription($enabled:Boolean):void

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.

Parameters

$enabled:Boolean

Constant Detail
ANDROID_SDK_VERSIONConstant
public static const ANDROID_SDK_VERSION:String = 3.13.0

IOS_SDK_VERSIONConstant 
public static const IOS_SDK_VERSION:String = 2.10.0