In-App Triggers
Triggers are events that you fire to show In-App Messages within your app. They are created within the OneSignal Dashboard.Every time you add or remove a trigger with the below methods, the OneSignal SDK will evaluate if an In-App Message should be shown based on the conditions set on it when it was created in the OneSignal Dashboard. Triggers are reset each time your app is closed, so make sure to set them again when starting your app if you need any of them to be persistent.addTrigger Method
Add a trigger. May show an In-App Message if its trigger conditions were met.
addTriggers Method
Add a map of triggers. May show an In-App Message if its trigger conditions were met.
removeTriggerForKey Method
Removes a single trigger for the given key. May show an In-App Message if its trigger conditions were met.
removeTriggersForKeys Method
Removes a list of triggers based on a collection of keys. May show an In-App Message if its trigger conditions were met.
getTriggerValueForKey Method
Gets a trigger value for a provided trigger key.
Prevent In-App From Showing Temporarily
pauseInAppMessages Method
Allows you to temporarily pause all In-App Messages. You may want to do this while the user is engaged in an activity that you don’t want a message to interrupt (such as watching a video).
In-App Message Click Handler
setInAppMessageClickHandler Method
Sets an In-App Message opened handler. The instance will be called when an In-App Message action is tapped on.
In-App Message Click HandlerUse to process an In-App Message the user just tapped on.
OSInAppMessageAction Class
Details about the In-App Message action element (button or image) that was tapped on.
In-App Message Lifecycle Handler
Requires iOS SDK version 3.7.0+ Requires Android SDK version 4.6.0+ The In-App Message Lifecycle Handler gives insight into the display lifecycle of In-App Messages. The Lifecycle Handler has four lifecycle methods that you can override in order to run code at particular times in this process.setInAppMessageLifecycleHandler Method
Sets an In-App Message lifecycle handler.
The
OSInAppMessageLifecycleHandler Class/Protocol includes the following optional methods.