Skip to content

[Fix] Xiaomi notification click not foregrounding app#2129

Merged
jkasten2 merged 1 commit intomainfrom
fix/xiaomi_foreground_on_click
Jun 18, 2024
Merged

[Fix] Xiaomi notification click not foregrounding app#2129
jkasten2 merged 1 commit intomainfrom
fix/xiaomi_foreground_on_click

Conversation

@jkasten2
Copy link
Copy Markdown
Member

@jkasten2 jkasten2 commented Jun 17, 2024

Description

One Line Summary

Fixes a bug where tapping on a OneSignal notification on a Xiaomi device doesn't bring the app to the foreground.

Details

Xiaomi has very strict activity trampolining rules on notification open. We have to start the next activity before the current activity is finished.

Motivation

Xiaomi devices are commonly used so it is important notifications open behaves correctly.

Scope

Delays when the invisible activity is closed.

Related

Testing

Manual testing

Tested on Xiaomi Redmi 6A device with MIUI 11.0.8 (Android 9) as well as an Android 14 emulator with the following scenarios:

  1. Background the app and tap on a notification
  2. Swipe away the app and tap on a notification.
  3. When the app is in the foreground tap on a notification
  4. While the app is closed and the device is offline tap on a notification.

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
  • 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
    • An automated is tricky, it needs to be more of an integration style test, as should be a test resilient to refactors.
  • 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.
  • I have reviewed this PR myself, ensuring it meets each checklist item

This change is Reviewable

This fixes a bug where tapping on a OneSignal notification on a Xiaomi
device doesn't bring the app to the foreground.
Xiaomi has very strict activity trampolining rules on notification
open. We have to start the next activity before the current activity is
finished.

Tested on Xiaomi Redmi 6A device with MIUI 11.0.8 (Android 9) as well
as an Android 14 emulator.
@jkasten2 jkasten2 changed the title [Fix] Xiaomi notification click not foregrounding [Fix] Xiaomi notification click not foregrounding app Jun 17, 2024
Copy link
Copy Markdown
Contributor

@nan-li nan-li left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @emawby, @jennantilla, @jinliu9508, and @shepherd-l)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Xiaomi - Notification Open - Not foregrounding app (SDK 5)

3 participants