Android lock screen page to avoid problems such as the lock screen background process being killed by the system and not receiving push notifications

The project encountered a problem, that is, after the mobile phone is running in the background, the push message cannot be received.

 

Especially for Meizu phones, when the background runs for 100 seconds, the process will be killed. Unable to receive push messages. Tried Service and BroadcastService can not wake up. Later, I studied the lock screen page. As long as the Meizu user authorizes the application to allow the lock screen display, it will remain active in the background and will not be killed.

 

Our project is special, and installing our application will authorize all the permissions of our application.

 

Then I tested Xiaomi and Huawei, and both work normally. I tested the Google mobile phone, and it is really awesome. As long as the application is not killed in the system settings, it can run in the background when the application is closed. Restart the phone, it will wake up automatically.

 

Source code download address: https://download.csdn.net/download/landly/10400708, available for personal testing. Comments are welcome.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326018412&siteId=291194637