Use this file to discover all available pages before exploring further.
The methods below require the OneSignal SDK versions 3 & 4.It is recommended to upgrade to our latest version 5 SDKs for User Model APIs.See Update to User Model for migration steps.
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.
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).
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.
Instance of a class implementing this abstract class/protocol.
The 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.
OneSignal.setInAppMessageLifecycleHandler( new OSInAppMessageLifecycleHandler() { // Add one or more of the following optional lifecycle methods @Override public void onWillDisplayInAppMessage(OSInAppMessage message) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.VERBOSE, "OSInAppMessageLifecycleHandler: onWillDisplay Message: " + message.getMessageId()); } @Override public void onDidDisplayInAppMessage(OSInAppMessage message) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.VERBOSE, "OSInAppMessageLifecycleHandler: onDidDisplay Message: " + message.getMessageId(); } @Override public void onWillDismissInAppMessage(OSInAppMessage message) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.VERBOSE, "OSInAppMessageLifecycleHandler: onWillDismiss Message: " + message.getMessageId()); } @Override public void onDidDismissInAppMessage(OSInAppMessage message) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.VERBOSE, "OSInAppMessageLifecycleHandler: onDidDismiss Message: " + message.getMessageId()); } });