In the MediaPlayer when playing video
Mmediaplayer.setscreenonwhileplaying (TRUE); has been set, there is no problem with native Android and there is no problem on the defy, one to Samsung's Galaxy has a problem, do not know where Samsung they changed. General words are set up to play the video screen without automatic. But there was a problem on Samsung. I had to look again. There are two ways to set up general words.
As follows:
Copy Code code as follows:
1. GetWindow (). Addflags (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
2.
Enabled in Onresume
Wakelock = ((PowerManager) Getsystemservice (Power_service))
. Newwakelock (Powermanager.screen_bright_wake_lock
| Powermanager.on_after_release, TAG);
Wakelock.acquire ();
Disabled in OnPause
if (Wakelock!= null) {
Wakelock.release ();
}
Both of these methods are not possible in galaxy.
The third method:
Copy Code code as follows:
Mcontentresolver = Getcontentresolver ();
Setlockpatternenabled (FALSE);
public void Setlockpatternenabled (Boolean enabled) {
SetBoolean (Android.provider.Settings.System.LOCK_PATTERN_ENABLED,
Enabled);
}
private void SetBoolean (String systemsettingkey, Boolean enabled) {
Android.provider.Settings.System.putInt (Mcontentresolver,
Systemsettingkey, enabled? 1:0);
}
Permission <uses-permission android:name= "Android.permission.WRITE_SETTINGS"/>
After this setting, you can disable the lock screen.