OneSignal Mobile SDK Methods for In-App Messages
addTrigger
MethodParameter | Type | Description |
---|---|---|
key | String, NSString | Key for the trigger. |
value | Object, id(String or number recommended) | Value for the trigger. Object passed in will be converted to a string. |
addTriggers
MethodParameter | Type | Description |
---|---|---|
triggers | Map<String, Object>, NSDictionary<NSString *, id> | Allows you to set multiple trigger key/value pairs simultaneously. |
removeTriggerForKey
MethodParameter | Type | Description |
---|---|---|
key | String, NSString | Key for trigger to remove. |
removeTriggersForKeys
MethodParameter | Type | Description |
---|---|---|
keys | Collection | Removes a collection of triggers from their keys. |
getTriggerValueForKey
MethodParameter | Type | Description |
---|---|---|
key | String, NSString | Returns a single trigger value for the given key, if it exists, otherwise returns null or nil in iOS. |
Return Type | Description |
---|---|
Object (Android) id (iOS) String (Unity) | Value if added with addTrigger , or null /nil (iOS) if never set. |
pauseInAppMessages
MethodParameter | Type | Description |
---|---|---|
pause | Boolean | To pause, set true . To resume, set false . |
setInAppMessageClickHandler
MethodParameter | Type | Description |
---|---|---|
handler | OSInAppMessageClickHandler (Android)OSInAppMessageClickBlock (iOS) | Instance to a class implementing this interference. |
Parameter | Type | Description |
---|---|---|
result | OSInAppMessageAction | Details about the In-App Message action element (button or image) that was tapped on. |
OSInAppMessageAction
ClassType | Method/Property | Description |
---|---|---|
String``NSString | getClickName()``clickName``click_name | An optional click name defined for the action element.null or nil (iOS) if not set |
String``NSURL | getClickUrl()``clickUrl``click_url | An optional URL that opens when the action takes place.null or nil (iOS) if not set. |
boolean``BOOL | isFirstClick()``firstClick``first_click | true if this is the first time the user has pressed any action on the In-App Message. |
boolean``BOOL | doesCloseMessage()``closesMessage``closes_message | true = the In-App Message will animate off the screen. false = the In-App Message will stay on screen until the user dismisses it. |
List<OSInAppMessageOutcome>``NSArray<OSInAppMessageOutcome *> | getOutcomes()``outcomes | Outcome for action. Mainly useful for debugging |
List<OSInAppMessagePrompt>``OSInAppMessagePrompt | getPrompts()``prompts | Permission prompts. Mainly useful for debugging |
OSInAppMessageTag | getTags()``tags | Tags for action. Mainly useful for debugging |
OSInAppMessageActionUrlType | getUrlTarget()``urlTarget``url_target | Determines where the URL is opened, ie. Mainly useful for debugging |
setInAppMessageLifecycleHandler
MethodParameter | Type | Description |
---|---|---|
handler (Android)delegate (iOS) | OSInAppMessageLifecycleHandler | Instance of a class implementing this abstract class/protocol. |
OSInAppMessageLifecycleHandler
Class/Protocol includes the following optional methods.
Method | Details |
---|---|
onWillDisplayInAppMessage(OSInAppMessage message) | This method will be called after the In-App Message content has been loaded, but before it has been displayed. If the content load fails, this method will not be called. |
onDidDisplayInAppMessage(OSInAppMessage message) | This method will be called after the In-App Message is displayed on screen. |
onWillDismissInAppMessage(OSInAppMessage message) | This method will be called when an an event to dismiss the In-App Message is fired. This method is also called for auto-dismissed In-App Messages. |
onDidDismissInAppMessage(OSInAppMessage message) | This method will be called when the In-App Message is completely dismissed from the screen. |
OSInAppMessage
ClassIdentifiable details of an In-App Message.Type | Method/Property | Description |
---|---|---|
String``NSString | getMessageId()``messageId | The generated ID of the In-App Message. |