直接上代码
import android.os.PowerManager;
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
//如果不是在Activity里面需要得到当时的上下文句柄 用context.getSystemService...
boolean isScreenOn = pm.isScreenOn();
直接上代码
import android.os.PowerManager;
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
//如果不是在Activity里面需要得到当时的上下文句柄 用context.getSystemService...
boolean isScreenOn = pm.isScreenOn();