简体   繁体   中英

Service running but threads are stopped

I have created a foreground service which spawns some repeating threads in ScheduledThreadPoolExecutor.

I want to keep the service and its threads running. I only stop threads in the onDestroy method of service.

When I close the app from recents the foreground notification remains as I desire. But the problem is: In Device1 threads are stopped while in Device2 they keep running.

Device1: A miui ROM smartphone Device2: A google ROM smartphone

Is there any way I can keep the threads running? I have checked that the onDestroy method is not being called. I have enabled autostart in MIUI device.

Seems like this is device issue. In the MIUI device I have tested multiple times, sometimes threads keep running while in some other case they don't.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM