Skip to content

fix(webview): force IAM render on android 5 and 6 #2345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sherwinski
Copy link
Contributor

@sherwinski sherwinski commented Aug 6, 2025

Description

One Line Summary

WIP - seeking high-level feedback

Fixes an issue where IAM are received, but not rendered, in Android versions 5 and 6.

Details

After debugging, it looks like there is a JavaScript issue within WebView, resulting in the rendering_complete event to not fire. Therefore, the SDK will indefinitely wait for this event before showing the IAM. At this point, it is not clear what the specific issue could be that causes this to happen.

The current approach creates a time-based (3 seconds) fallback which will manually send the rendering_complete event if it one is not automatically sent as expected. This is not an ideal solution, so I am currently seeking feedback on a more idiomatic approach.

Motivation

Following up on this action item from a previous PR: this change addresses an issue where an IAM is not shown on older Android versions.

Testing

Unit testing

None added, seeking feedback here as well.

Manual testing

Tested on Android emulator for both API versions 23 and 22 (Android 6 and 5, respectively)

Create a segment on your app via dashboard.onesignal.com. Have the segment target users with a tag similar to {'user': '1'}. Finally, create and publish an In-App Message that targets this segment.

Build and run a new install of the app on either Android 6 or 5

  1. Open the app, accept push permissions
  2. Login user and add the tag mentioned above, e.g. {'user': '1'}
  3. Completely close the app, reopen and wait

Before this change: no IAM would appear
After this change: the IAM appears after 3 seconds

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

This change is Reviewable

@sherwinski sherwinski added the WIP Work In Progress label Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WIP Work In Progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant