Packagecom.tuarua
Classpublic class OneSignal
InheritanceOneSignal Inheritance flash.events.EventDispatcher



Public Properties
 PropertyDefined By
  sdkType : String
[static] [read-only]
OneSignal
  userProvidedPrivacyConsent : Boolean
[read-only]
OneSignal
  version : String
[static] [read-only]
OneSignal
Public Methods
 MethodDefined By
  
addTrigger(key:String, value:*):void
Allows you to set an individual trigger key/value pair for in-app message targeting
OneSignal
  
addTriggers(json:String):void
Allows you to set multiple trigger key/value pairs simultaneously with a Map Triggers are used for targeting in-app messages.
OneSignal
  
cancelNotification(id:int):void
Cancels a single OneSignal notification based on its Android notification integer ID.
OneSignal
  
Removes all OneSignal notifications from the Notification Shade.
OneSignal
  
consentGranted(value:Boolean):void
If your application is set to require the user's privacy consent, you can provide this consent using this method.
OneSignal
  
deleteTag(key:String):void
Deletes a single tag that was previously set on a user with sendTag or sendTags.
OneSignal
  
deleteTags(keys:Vector.<String>):void
Deletes one or more tags that were previously set on a user with sendTag or sendTags.
OneSignal
  
dispose():void
[static] Disposes the ANE
OneSignal
  
enableSound(value:Boolean):void
By default OneSignal plays the system's default notification sound when the device's notification system volume is turned on.
OneSignal
  
enableVibrate(value:Boolean):void
By default OneSignal always vibrates the device when a notification is displayed unless the device is in a total silent mode.
OneSignal
  
Get the current notification and permission state.
OneSignal
  
getTags(listener:Function):void
Retrieve a list of tags that have been set on the user from the OneSignal server.
OneSignal
  
getTriggerValueForKey(key:String):String
Returns a single trigger value for the given key (if it exists, otherwise returns null)
OneSignal
  
init(appId:String, autoPromptLocation:Boolean = false, disableGmsMissingPrompt:Boolean = false, filterOtherGCMReceivers:Boolean = false, unsubscribeWhenNotificationsAreDisabled:Boolean = false, inFocusDisplaying:int):void
OneSignal
  
Call when user logs out of their account.
OneSignal
  
pauseInAppMessages(pause:Boolean):void
Can temporarily pause in-app messaging on this device.
OneSignal
  
postNotification(json:String, onSuccess:Function = null, onFailure:Function = null):void
Allows you to send notifications from user to user or schedule ones in the future to be delivered to the current device.
OneSignal
  
Prompts the user for location permissions to allow geotagging from the OneSignal dashboard.
OneSignal
  
removeExternalUserId(listener:Function = null):void
If your user logs out of your app, and you would like to disassociate their custom User ID rom your system with their OneSignal User ID, you will want to call this method.
OneSignal
  
removeTriggerForKey(key:String):void
Removes a single trigger for the given key
OneSignal
  
removeTriggersForKeys(keys:Vector.<String>):void
Removes a list/collection of triggers from their keys with a Collection of Strings
OneSignal
  
sendTag(key:String, value:Boolean):void
Tag a user based on an app event of your choosing so later you can later create segments to target these users.
OneSignal
  
sendTags(json:String):void
Tag a user based on an app event of your choosing, so that later you can create segments to target these users.
OneSignal
  
setEmail(email:String, emailAuthHash:String = null, onSuccess:Function = null, onFailure:Function = null):void
Set an email for the device to later send emails to this address
OneSignal
  
setExternalUserId(userId:String, listener:Function = null):void
If your system assigns unique identifiers to users, it can be to have to also remember their OneSignal Player Id's as well.
OneSignal
  
setInFocusDisplaying(type:int):void
Setting to control how OneSignal notifications will be shown when one is received while your app is in focus.
OneSignal
  
setLocationShared(value:Boolean):void
Disable or enable location collection (defaults to enabled if your app has location permission).
OneSignal
  
setLogLevel(logLevel:int, visualLevel:int):void
Enable logging to help debug if you run into an issue setting up OneSignal.
OneSignal
  
setRequiresUserPrivacyConsent(value:Boolean):void
For GDPR users, your application should call this method before initialization of the SDK.
OneSignal
  
setSubscription(value:Boolean):void
The user must first subscribe through the native prompt or app settings.
OneSignal
  
[static] The ANE instance.
OneSignal
Property Detail
sdkTypeproperty
sdkType:String  [read-only]


Implementation
    public static function get sdkType():String
userProvidedPrivacyConsentproperty 
userProvidedPrivacyConsent:Boolean  [read-only]


Implementation
    public function get userProvidedPrivacyConsent():Boolean
versionproperty 
version:String  [read-only]


Implementation
    public static function get version():String
Method Detail
addTrigger()method
public function addTrigger(key:String, value:*):void

Allows you to set an individual trigger key/value pair for in-app message targeting

Parameters

key:String
 
value:*

addTriggers()method 
public function addTriggers(json:String):void

Allows you to set multiple trigger key/value pairs simultaneously with a Map Triggers are used for targeting in-app messages.

Parameters

json:String

cancelNotification()method 
public function cancelNotification(id:int):void

Cancels a single OneSignal notification based on its Android notification integer ID.

Parameters

id:int

clearOneSignalNotifications()method 
public function clearOneSignalNotifications():void

Removes all OneSignal notifications from the Notification Shade.

consentGranted()method 
public function consentGranted(value:Boolean):void

If your application is set to require the user's privacy consent, you can provide this consent using this method. Until you call provideUserConsent(true), the SDK will not fully initialize, and will not send any data to OneSignal.

Parameters

value:Boolean

deleteTag()method 
public function deleteTag(key:String):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

deleteTags()method 
public function deleteTags(keys:Vector.<String>):void

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

Parameters

keys:Vector.<String> — Keys to remove

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

Disposes the ANE

enableSound()method 
public function enableSound(value:Boolean):void

By default OneSignal plays the system's default notification sound when the device's notification system volume is turned on.

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.

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

Parameters

value:Boolean — Passing false means that the device will only vibrate unless the device is set to a total silent mode.

enableVibrate()method 
public function enableVibrate(value:Boolean):void

By default OneSignal always vibrates the device when a notification is displayed unless the device is in a total silent mode.

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.

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

Parameters

value:Boolean — Passing false means that the device will only vibrate lightly when the device is in it's vibrate only mode.

getPermissionSubscriptionState()method 
public function getPermissionSubscriptionState():OSPermissionSubscriptionState

Get the current notification and permission state.

Returns
OSPermissionSubscriptionState
getTags()method 
public function getTags(listener:Function):void

Retrieve a list of tags that have been set on the user from the OneSignal server. Android will provide a cached copy if there is no network connection.

Parameters

listener:Function

getTriggerValueForKey()method 
public function getTriggerValueForKey(key:String):String

Returns a single trigger value for the given key (if it exists, otherwise returns null)

Parameters

key:String

Returns
String
init()method 
public function init(appId:String, autoPromptLocation:Boolean = false, disableGmsMissingPrompt:Boolean = false, filterOtherGCMReceivers:Boolean = false, unsubscribeWhenNotificationsAreDisabled:Boolean = false, inFocusDisplaying:int):void

Parameters

appId:String
 
autoPromptLocation:Boolean (default = false)
 
disableGmsMissingPrompt:Boolean (default = false)
 
filterOtherGCMReceivers:Boolean (default = false)
 
unsubscribeWhenNotificationsAreDisabled:Boolean (default = false)
 
inFocusDisplaying:int (default = NaN)

logoutEmail()method 
public function logoutEmail():void

Call when user logs out of their account. This dissociates the device from the email address. This does not effect the subscription status of the email address itself.

pauseInAppMessages()method 
public function pauseInAppMessages(pause:Boolean):void

Can temporarily pause in-app messaging on this device. Useful if you don't want to interrupt a user while playing a match in a game.

Parameters

pause:Boolean — The boolean that pauses/resumes in-app messages

postNotification()method 
public function postNotification(json:String, onSuccess:Function = null, onFailure:Function = null):void

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

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

json:String — Contains notification options, see OneSignal | Create Notification POST call for all options.
 
onSuccess:Function (default = null)
 
onFailure:Function (default = null)

promptLocation()method 
public function promptLocation():void

Prompts the user for location permissions to allow geotagging from the OneSignal dashboard. This lets you send notifications based on the device's location. See Location-Triggered Notifications for more details. Make sure you add location permissions in your AndroidManifest.xml and/or info.plist.

removeExternalUserId()method 
public function removeExternalUserId(listener:Function = null):void

If your user logs out of your app, and you would like to disassociate their custom User ID rom your system with their OneSignal User ID, you will want to call this method.

Parameters

listener:Function (default = null)

removeTriggerForKey()method 
public function removeTriggerForKey(key:String):void

Removes a single trigger for the given key

Parameters

key:String

removeTriggersForKeys()method 
public function removeTriggersForKeys(keys:Vector.<String>):void

Removes a list/collection of triggers from their keys with a Collection of Strings

Parameters

keys:Vector.<String>

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

Tag a user based on an app event of your choosing so later you can later create segments to target these users. Use sendTags 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:Boolean — 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 function sendTags(json:String):void

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

Parameters

json:String

setEmail()method 
public function setEmail(email:String, emailAuthHash:String = null, onSuccess:Function = null, onFailure:Function = null):void

Set an email for the device to later send emails to this address

Parameters

email:String — The email that you want subscribe and associate with the device
 
emailAuthHash:String (default = null) — Generated auth hash from your server to authorize. (Recommended) Create and send this hash from your backend to your app after the user logs into your app. DO NOT generate this from your app! Omit this value if you do not have a backend to authenticate the user.
 
onSuccess:Function (default = null) — if the update succeeds
 
onFailure:Function (default = null) — if the update fails

setExternalUserId()method 
public function setExternalUserId(userId:String, listener:Function = null):void

If your system assigns unique identifiers to users, it can be to have to also remember their OneSignal Player Id's as well. To make things easier, OneSignal now allows you to set an external_user_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
 
listener:Function (default = null)

setInFocusDisplaying()method 
public function setInFocusDisplaying(type:int):void

Setting to control how OneSignal notifications will be shown when one is received while your app is in focus.

Parameters

type:int

setLocationShared()method 
public function setLocationShared(value:Boolean):void

Disable or enable location collection (defaults to enabled if your app has location permission).

Note: This method must be called before OneSignal init on iOS.

Parameters

value:Boolean

setLogLevel()method 
public 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.

Parameters

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

setRequiresUserPrivacyConsent()method 
public function setRequiresUserPrivacyConsent(value:Boolean):void

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.

Parameters

value:Boolean

setSubscription()method 
public function setSubscription(value:Boolean):void

The user must first subscribe through the native prompt or app settings. It does not officially subscribe or unsubscribe them from the app settings, it unsubscribes them from receiving push from OneSignal. You can only call this method with false to opt out users from receiving notifications through OneSignal. You can pass true later to opt users back into notifications.

Parameters

value:Boolean

shared()method 
public static function shared():OneSignal

The ANE instance.

Returns
OneSignal