screen-lock

How to disable home button in Android like lock screen apps do?

血红的双手。 提交于 2019-12-03 19:07:19
问题 I know this question is asked many times but I found that none of the solution is working. I tried the code given below... protected void onPause() { super.onPause(); Intent intent = new Intent(this,LockActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT |Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } What it does is that it bring the current activity again to front when android home screen is launched but it takes almost 3-4 seconds to bring activity againt to

unable to detect shake event when my phones screen is off in android

帅比萌擦擦* 提交于 2019-12-03 09:00:29
In my application I want to detect the shake event and I'm using SensorEventListener, the code is working fine when my activity is running in foreground. But when I press the lock button of the phone to lock the screen, the shake event can't be detected. I have tested my code on the Samsung gts5360. But the same code is working fine on sony ericssion xperia mini pro. Actually my Samsung phone is not detecting the shake events when I leave the device idle for approx. 45 seconds, after locking the device. Then I shake the phone, it does not detect the shake, but when I shake phone after several

How to lock Android screen via ADB?

只愿长相守 提交于 2019-12-03 02:27:25
问题 Is there a way to lock the Android screen via the ADB? I find ways to lock the display in an apk, but I want to lock the screen from the PC via ADB, to simulate a display timeout, without having to wait for the timeout. Is it possible to do this? Thanks, Diane 回答1: Cool, I just found KEYCODE_POWER which is 26. so it works by sending: adb shell input keyevent 26 which locks the screen if the screen is unlocked. If the screen is already locked, it wakes up the device. My guess is that the only

How to lock Android screen via ADB?

拟墨画扇 提交于 2019-12-02 14:22:19
Is there a way to lock the Android screen via the ADB? I find ways to lock the display in an apk, but I want to lock the screen from the PC via ADB, to simulate a display timeout, without having to wait for the timeout. Is it possible to do this? Thanks, Diane PurpleDiane Cool, I just found KEYCODE_POWER which is 26. so it works by sending: adb shell input keyevent 26 which locks the screen if the screen is unlocked. If the screen is already locked, it wakes up the device. My guess is that the only way to ensure that the screen is locked (off), is to unlock (we use keyevent 82 (menu), then

Is it possible to hide all the controls when screen is locked? - objective c

寵の児 提交于 2019-12-02 07:35:18
I want to hide all the controls on the locked screen when an app is playing in the background. However, I want the audio related information to be displayed all the time. I read about MPRemoteCommandCenter but we can't implement the below code because when you try to disable all then the screen starts showing 3 controls (toggle button, next track, previous track) MPRemoteCommandCenter *rcc = [MPRemoteCommandCenter sharedCommandCenter]; [[rcc skipForwardCommand] setEnabled:NO]; [[rcc skipBackwardCommand] setEnabled:NO]; [[rcc nextTrackCommand] setEnabled:NO]; [[rcc previousTrackCommand]

Detect Lock Screen Incorrect Password by user in Android

流过昼夜 提交于 2019-11-28 20:56:16
I am building a security app and I need to know if the user is giving incorrect password . Suppose user phone is locked by pattern lock system , and unfortunately user has forgotten the pattern password.When user give wrong pattern 5 time, there will be a penalty for 30 sec . I need to catch that penalty event . In my app, i have to do some task (for the safety of user) when this even come . Please help me, You can set up a DeviceAdminReceiver that will be notified about failed password attempts, as well as a successful password attempt that occurred after a failed attempt. This is covered in

Programmatically detect whether iOS passcode is enabled or not

∥☆過路亽.° 提交于 2019-11-28 04:00:57
Rather than build a passcode directly into my app and potentially require the user to enter a passcode twice (once for the device and again for my app); I thought I might out-clever myself and do something along the lines of: if (device has passcode) continue into my app else make user enter my app passcode I don't want to set the device passcode, I don't want to force a screen lock, not encrypting anything - all I really want is an API just to detect if a device passcode is in effect. Something like: BOOL notReally = [UIDevice isUserSlightlyMoreSecureBecauseTheySetDeviceLockOn]; or maybe if I

Detect Lock Screen Incorrect Password by user in Android

会有一股神秘感。 提交于 2019-11-27 13:20:05
问题 I am building a security app and I need to know if the user is giving incorrect password . Suppose user phone is locked by pattern lock system , and unfortunately user has forgotten the pattern password.When user give wrong pattern 5 time, there will be a penalty for 30 sec . I need to catch that penalty event . In my app, i have to do some task (for the safety of user) when this even come . Please help me, 回答1: You can set up a DeviceAdminReceiver that will be notified about failed password

Start Activity screen even if screen is locked in Android

前提是你 提交于 2019-11-27 12:54:59
How to start an Activity on device even if screen is locked. I tried as below but it's not working. Broadcast receiver: Intent alarmIntent = new Intent("android.intent.action.MAIN"); alarmIntent.setClass(context, Alarm.class); alarmIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); alarmIntent.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED + WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD + WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON + WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); context.startActivity(alarmIntent); You need the following permission in AndroidManifest.xml file:

How can i set up screen lock with a password programmatically?

坚强是说给别人听的谎言 提交于 2019-11-27 01:11:00
Is there any one that can help me with a code to set a password to lock the screen ? thx Shaahul Use this code in your App, it works for me: DevicePolicyManager devicePolicyManager = DevicePolicyManager.getSystemService(Context.DEVICE_POLICY_SERVICE); ComponentName demoDeviceAdmin = new ComponentName(this, name of activity); devicePolicyManager.setPasswordQuality( demoDeviceAdmin,DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED); devicePolicyManager.setPasswordMinimumLength(demoDeviceAdmin, 5); boolean result = devicePolicyManager.resetPassword("123456", DevicePolicyManager.RESET_PASSWORD