Example: App Version Update
In-App Messages are a great way to target devices on older versions of your app and let them know why they should upgrade your app to the latest version.
In-app message segments are evaluated first on a new session of the app. This happens before the device's app version is updated by the OneSignal SDK. The reason for this is to help display the message as quickly as possible. A new session is when the app is out of focus for 30 seconds+ and put back into focus.
Due to this session rule, devices might have a different app version upon a new session than the segment they are currently in and may get the IAM incorrectly.
For example, if the device was in a segment "app_version is 1.0.0" and already updated to app version 2.0.0
When the app is opened, the segment is evaluated as being in version 1.0.0 even though they have app version 2.0.0 So they will get the IAM even though they have the updated app_version already.
The only solution right now is to use addTrigger method and pass in the current app version. If the current app version is not the same as the trigger value set in the dashboard, display the IAM.
Requirements
- You will need a way to programmatically detect the current version of your app.
- You will need to use the OneSignal SDK
addTrigger
method.
Step 1. Setup Trigger Code
Within your code that checks the current app version, save the version as a string
variable.
Then use the OneSignal addTrigger
method. To pass in the app version as a value. See In-App Message SDK Methods.
For example:
String appVersion
OneSignal.addTrigger("current_app_version", appVersion);
Step 2. Setup In-App Message
In Messages > In-App you can use the default "New Feature Announcement" in-app message or create your own.
Audience
This should be "Show to all users".
Message
Update the message and set a Button to use the URL click action. You can enter the store link as the URL. If you are unsure what your store link looks like, see these references:
- Android - https://developer.android.com/distribute/marketing-tools/linking-to-google-play.html
- iOS - https://developer.apple.com/library/archive/qa/qa1633/_index.html
If you want to set for iOS and Android App stores separately, you can easily duplicate this in-app message and target 2 Segments, one for Android and another for iOS using the "Device Type" data filter. Simply update this URL for the Android and iOS Segment targeted in each URL Action.
Step 3. Triggers
Based on the Trigger code setup in Step 1. Set the IN-APP TRIGGER to be the key
is not and set the value
as the version of your app you want them to be on.
For example:
current_app_version
is not 3.0.0
Whatever version you detect from your app, if it is not the most recent version of your app, this will trigger.
Step 4. Schedule and Re-Trigger
Depending on when the new release is available for download, you can set the "Start Showing" time to be that date.
Under Advanced Settings set "How often do you want to show this message?" to be how often you want to show the message. In this example, we will show it a total of 10 times with a gap of 3 days in between each show. This means we will only show it a total of 10 times, once every 3 days as long as the user still has the version less than the version we want them to be on.
Depending on how urgent the update is, you can set the number of times to be as many as you want and the gap to be how frequently you want.
Click Update Message
You are now done. Your users will get notified of your App Update based on their current version and frequency set in step 4.
Updated almost 2 years ago