实现android手机常亮不锁屏
原理:
- PowerManager开启屏幕常亮
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "MyApp::MyWakelockTag");
mWakeLock.acquire();
- 启动前台服务startForeground