Home > Mobile >  Huawei mobile phone after the lock screen to enter a dormant state, receiving less than broadcast in
Huawei mobile phone after the lock screen to enter a dormant state, receiving less than broadcast in

Time:10-18

Lock screen after 5 minutes or not receive messages, but time is not long after the lock screen can receive message

Keep the background with wakelock Android lock screen state awaken but
 @ Override 
Protected void onPause () {
Super. OnPause ();
//handler. PostDelayed (bluetooth, TIME).//4 minutes to perform a
ReleaseWakeLock ();
}

//release equipment power lock 
Private void releaseWakeLock () {
if (null !=wakeLock & amp; & WakeLock. IsHeld ()) {
The Log. I (" WakeLock ", "call releaseWakeLock");
WakeLock. Release ();
WakeLock=null;
}
}


 @ Override 
Protected void onResume () {
Super. OnResume ();
AcquireWakeLock ();
}


/* ** access to the power lock, keep this service in screen dies still get CPU, keep running 
*/
Private void acquireWakeLock () {
If (null==wakeLock) {
PowerManager PM=(PowerManager) getSystemService (Context. POWER_SERVICE);
WakeLock=PM. NewWakeLock (PowerManager. PARTIAL_WAKE_LOCK
| PowerManager. ON_AFTER_RELEASE getClass ()
GetCanonicalName ());
if (null ! WakeLock)={
The Log. I (" WakeLock ", "call acquireWakeLock");
WakeLock. Acquire ();
}
}
}

CodePudding user response:

System version 6.0.1 EMUI4.0.3 system
Glory eight EMUI5.0.1 system (7.0) on the test no task

CodePudding user response:

Use the method of 1 pixel keep alive also didn't work
https://www.jianshu.com/p/ef4a9531bc15

CodePudding user response:

Thinking: AlarmManager used alarm clock timing to send radio cooperate PowerManager CPU is not sleep, receives the broadcast awaken and unlock the screen, and then in the drawbacks of the method of using lock screen when screen is flashing, but all the services, radio work,

CodePudding user response:

Cordova development also encounter this problem
I solved the

CodePudding user response:

Add white list and dormancy is prohibited

CodePudding user response:

The
reference 4 floor weixin_38918071 reply:
cordova development also encounter this problem
I solved the




How to solve?

CodePudding user response:

With timing task constantly awaken an error screen process
  • Related