Skip to content
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

[Fix] Xiaomi notification click not foregrounding app #2129

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

jkasten2
Copy link
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
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)

@jkasten2 jkasten2 merged commit 00e1792 into main Jun 18, 2024
3 checks passed
@jkasten2 jkasten2 deleted the fix/xiaomi_foreground_on_click branch June 18, 2024 17:58
@nan-li nan-li mentioned this pull request Jun 18, 2024
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