在这里我提到了唤醒屏幕的代码.我希望代码是监听仍然应用程序关闭和CPU清除,用户可以点击电源按钮,当我的屏幕解锁时,应用程序是同步像whatsapp.
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "whatever");
super.onCreate(savedInstanceState);
wl.acquire();
Run Code Online (Sandbox Code Playgroud)