You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: In-App not displaying when trigger is set for once #2269
My Android app uses the latest version of OneSignal. I currently implemented OneSignal for In-App messaging.
Keeping the key: is_user_signed_in with value true, it should trigger the in-app.
FYI, this code was called from LauncedEffect(Unit), i.e. everytime the screen is opened.
To avoid multiple triggers, I used a global boolean flag: var hasShownInAppMessaging: Boolean = false
This allowed me to trigger In-App once per session.
Schedule is set to: Every time trigger conditions are satisfied
But this didn't worked as expected.
When it actually got triggered?
First time
On Logout and Login (considering the trigger is for users when signed in)
The log says OperationRepo: execute response = SUCCESS with GOT Response
Steps to reproduce?
1. Install using version `5.1.29`2. Trigger OneSignal with a Key-Value pair
3. Create boolean flag = false
4. This trigger should be in `LaunchedEffect(Unit) {...}`5. Inside the block, check if boolean flag = true, return if yes.
6. Trigger for the OneSignal In-App
4. Set a boolean flag = true for first time trigger
What did you expect to happen?
I expected the app to trigger In-App only at Screen X, where it is triggered using is_user_signed_in with value true
This In-App should be triggered once per launch.
I expected the app to trigger In-App only at Screen X, where it is triggered using is_user_signed_in with value true
This In-App should be triggered once per launch.
Anytime you call OneSignal.InAppMessages.addTrigger(key: is_user_signed_in, value: true), the in-app message will display.
@nan-li Yes. I understand the addTrigger(...) code where it shows in-app whenever triggered.
My objective is to show it only one time per app launch. (Not in Splash or Auth Screen but trigger in Home Screen)
Triggering it in Home Screen caused to trigger it multiple times whenever the screen is launched.
So, for now my objective is to restrict it triggering multiple times and only trigger one time per app launch.
What I tried?
I tried creating a boolean flag to set true once the trigger is invoked. And the second time it returns without any changes or re-trigger.
Did it worked?
No.
On what cases it worked?
App launch (First time). On relaunch it did not worked as expected but logged that it triggered it.
Re-login (Home Screen -> Auth -> Home Screen) [Trigger logic is in Home Screen, and boolean flag is in host Activity.]
FYI: It's happening the same for both Android and iOS
Hi @binay-shaw-ionage apologies for the delay. Is this still relevant? If so, I am still unsure of how to answer your question.
Any boolean flags to track state or launching from a different screen is outside of the SDK's involvement. The only thing I can help address is whenever you call OneSignal.InAppMessages.addTrigger, the in-app should display. Are you saying that you call OneSignal.InAppMessages.addTrigger but the in-app message does not display?
Activity
nan-li commentedon Mar 7, 2025
Hi @binay-shaw-ionage, I don't understand your question.
Anytime you call
OneSignal.InAppMessages.addTrigger(key: is_user_signed_in, value: true), the in-app message will display.binay-shaw-ionage commentedon Mar 10, 2025
@nan-li Yes. I understand the
addTrigger(...)code where it shows in-app whenever triggered.My objective is to show it only one time per app launch. (Not in Splash or Auth Screen but trigger in Home Screen)
Triggering it in Home Screen caused to trigger it multiple times whenever the screen is launched.
So, for now my objective is to restrict it triggering multiple times and only trigger one time per app launch.
What I tried?
I tried creating a boolean flag to set true once the trigger is invoked. And the second time it returns without any changes or re-trigger.
Did it worked?
No.
On what cases it worked?
FYI: It's happening the same for both Android and iOS
binay-shaw-ionage commentedon Mar 11, 2025
I also see
shouldDisplayAgainto show when the in-app appears.When in-app is not triggered,
shouldDisplayAgainis not in the log as well.FYI:
shouldDisplayAgainis a part of OneSignal log.nan-li commentedon Dec 2, 2025
Hi @binay-shaw-ionage apologies for the delay. Is this still relevant? If so, I am still unsure of how to answer your question.
Any boolean flags to track state or launching from a different screen is outside of the SDK's involvement. The only thing I can help address is whenever you call
OneSignal.InAppMessages.addTrigger, the in-app should display. Are you saying that you callOneSignal.InAppMessages.addTriggerbut the in-app message does not display?