apache / apache/cordova-android

JS event 'resume' on Android 11 doesn`t work correctly during app start

Open
#1,397 2 comments 0 reactions 0 assignees View on GitHub
info-needed / awaiting response
Dominant language
JavaScript
Stars
3.8k
Forks
1.6k
Avg merge
16h 18m
Merged PRs (30d)
11

Description

### Issue Type

- [x] Bug Report
- [ ] Feature Request
- [ ] Support Question

## Description
In my case:
When app runnig at first time after installation, callback into event listener on 'resume' event, doesn`t work.
## Information

In my code i added evnetListener on window.document, with params ('resume', onResume, false ) and in case witch is described above, callback onResume doesn`t work. Reproducibility of case is constant. Problem appeared only at Android 11, same code work correctly at Android with lower os version. IOS working correctly.

Case:
1. Install app
2. Launch app
3. Hide(minimize) app
4. Tap on app icon again
Result: callback doesnt work

You can repeat this case and there will be the same result while your app is on memory.
After unloading app from memory, and restart app problem dissapear.

When i change window.document.addEventListener('resume', ...) to window.document.onresume(...) - the problem continued.
### Command or Code

const onResume = () => alert('resume event');
window.document.addEventListener('resume', onResume, false);
### Environment, Platform, Device

Samsung Galaxy S20 Ultra, 11 Android - working **incorrect**
Samsung Galaxy A52, 11 Android - working **incorrect**

Nokia TA-1053, 10 Android - working _correct_
Samsung Galasy s9, 10 Android - working _correct_
iPhone 11, IOS 12.1 - working _correct_

### Version information

Android 11
Cordova 10.0.0

## Checklist

- [x] I searched for already existing GitHub issues about this
- [ ] I updated all Cordova tooling to their most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Android 11 case with the shown window.document.addEventListener('resume', onResume, false) code: install, launch, minimize, and reopen the app. Compare the resume behavior with Android 10 and iOS, and inspect the app lifecycle entry points involved in dispatching the event. Done means the callback fires consistently when an app is reopened on Android 11 without regressing other listed platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.