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

Why the example looping is not incrementing values in background on Xiaomi (MIUI 13) #194

Open
mlwong54 opened this issue Sep 25, 2023 · 2 comments

Comments

@mlwong54
Copy link

mlwong54 commented Sep 25, 2023

Hi I set up the app as instructed and the background service seems working when opening the app

const veryIntensiveTask = async (taskDataArguments) => {
console.log(taskDataArguments)
const { delay } = taskDataArguments
await new Promise(async (resolve) => {
for (let i = 0; BackgroundService.isRunning(); i++) {
console.log(i)
await BackgroundService.updateNotification({
taskDesc: Adding steps... + i,
})
await sleep(delay)
}
})
}

but when i closed the app the console update just stop so as the BackgroundService.updateNotification
shouldn't this defeats the whole purpose of background action?
it should be looping infinitely but the notification stops refreshing after the app went background.
what is happening?

@mlwong54
Copy link
Author

mlwong54 commented Sep 25, 2023

I am running the app on Redmi 12C(Android 12). Is this the cause for the inactivity?

@mlwong54
Copy link
Author

Oh I found out that the MIUI will kill the background task aggressively.
I tried using the solution here but to no avail: https://dontkillmyapp.com/xiaomi
If someone uses Xiaomi phone with MIUI, please tell me if you have solve the problem.

@mlwong54 mlwong54 changed the title Why the example looping is not incrementing values in background Why the example looping is not incrementing values in background on Xiaomi (MIUI 13) Sep 26, 2023
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

No branches or pull requests

1 participant