これを使用して画面をスリープ状態にすることができます。 はウェイクするには、次の
保護のボイドウェイクアップ(){
//to wake the screen
PowerManager pm = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakeLock = pm.newWakeLock((PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP), "TAG");
wakeLock.acquire();
//to release the screen lock
KeyguardManager keyguardManager = (KeyguardManager) getApplicationContext().getSystemService(Context.KEYGUARD_SERVICE);
KeyguardManager.KeyguardLock keyguardLock = keyguardManager.newKeyguardLock("TAG");
//add permission in the manifest file for the disablekeyguard
keyguardLock.disableKeyguard();
// Intent intent=new Intent("android.intent.category.LAUNCHER");
//Intent.setClassName("com.samsung.android.sdk.accessory.example.helloaccessory.provider", "com.samsung.android.sdk.accessory.example.helloaccessory.provider.Main3Activity");
}
それが動作していない、感謝 –
このコードの助けがちょうど目を覚ますために、その後、あなたは可能App.Can開くための関数を呼び出すことができます特定のエラーは何ですか? –
電話機を数分間ロックすると、CPUモードがオフになります。このモードでは、上記の方法をもう使用することができます。 –