/** * 解锁屏 * @param context */ public static void unLockScreen(Context context) { KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); KeyguardManager.KeyguardLock kl = km.newKeyguardLock("unLock"); // 解锁 kl.disableKeyguard(); } /** * 点亮屏幕 * @param context */ public static void lightUpScreen(Context context) { PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "A_LOG"); wl.acquire(); wl.release(); }
振动:
private static final long[] sVibratePattern = new long[] { 500, 500 }; Vibrator mVibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); //开始振动 mVibrator.vibrate(sVibratePattern, 0); //取消振动 //mVibrator.cancel();