Lock screen on iOS and Android - android

I'm building my app with Phonegap. What I want to do is create a button on the screen and add a lock-screen event onclick. I searches on other posts but everyone tries to check if the screen is locked and execute then or before something. I only need the event (lock screen) to happen when clicking that button. It's exactly like you would lock it from the physical button on the iPhone but only it happens by clicking a button.
I need it both for iOS and Android but if you could give me a hint for only one, is welcomed.
Thank you!

For Android side;
As far as i know you app need to be registered on the device as an admin app. Then you can use the Device Administration API to lock the screen by DevicePolicyManager.lockNow()

Related

Cordova/Ionic2 | How to lock and unlock Screen of Android and iOS?

I just want to find a plugin that can trigger the native device screen lock button.
So for example if you click a button your device gets locked just it would do if you click your devices native lock button on the side of the phone. For example if your lock button of the device is broken you could do this within an app.
As far as I can tell the only plugin that would work is this one:
https://github.com/kitolog/cordova-plugin-screen-locker . But it seems it only works for android (And might aswell only lock the screen orientation).
window.screenLocker.unlock(successCallback, errorCallback, 10); // 10 seconds unlock timeout (third parameter is optional)
window.screenLocker.lock(successFun, errorFun); // release screen unlock
Is there any solution for iOS aswell? I really cant find anything.
There is a very good reason why the plugin is android-only, as there is no public API to lock the screen on iOS. In general, Apple is more restrictive as to what it allows its developers to do.
For a more in depth explanation, check out this answer.

Any way to force my app to stay open?

I'm working with a client who would like their app to always be visible on the tablet screen for their in-shop/display model. They would like this app to be locked on the screen so that if a person presses the home button it will go home and the app will stay open. Basically they want the app to be the only thing on this tablet. Are there any solutions from a software perspective that I can implement?
Set the application to kiosk mode
https://developer.android.com/work/cosu.html
https://sdgsystems.com/blog/implementing-kiosk-mode-android-part-1

Launcher or an App for Restricted Access which one is better?

Hi I am planning to create an android app which is similar to the
Samsung Kids Mode- parental control
If you can see the link I gave, it is obvious that the app overrides the Home button when inside the app... I wanted to create a similar app for friends mode and stranger mode and should not come out of the app when home button is pressed... is it possible without root access?? My ultimate aim is to not come out of the app without entering a password, So if it is just an app after android 4.0 it just comes to the home screen when home button is pressed, So If I create a custom launcher and make it default even after pressing home button it will be inside the app if I am right, but is there any way I can do the same without a launcher
Also to avoid the phone number suggestions which happens when we dial parts of numbers in the dialler, should the phone be rooted to so it or is it possible without that?
Thanks in advance to everyone for taking time to read this, hoping a positive solution

android application that is visible on lock screen same as emergency calls button

How to create an android app that will appear on the lock screen and can be started even if the phone is lock?
Such that the application icon is visible on the lock screen instead of menu. Similar to emergency calls button on the lock screen.
Can anyone please help me out in this?
I read many things but was not able to find such thing please help me out.
Starting with Android 4.2, you can create lockscreen widgets. If the user places it on the lockscreen, it works mostly like any other widget.

Android LockScreen customization

Is there a way to change the lock screen in Android programmatically?
If yes, is it possible to create an animation within that view?
Is there a way to change the lock screen in Android programmatically?
No, because there is only one lock screen. On Android 4.2, the user can add app widgets to the lock screen, if the user chooses. You can elect to create an app widget that can be added to the lock screen.
If yes, is it possible to create an animation within that view?
Generally, no. App widgets are not normally animated.
android doesn't officially supports it with a nice API , but there are some solutions for this problem . the best one that i can think of and that will work perfectly on all devices and android versions is this :
you can make an app that functions as a launcher , and ask the user to disable the lock screen.
this way , when the screen is turned off&on , your app will be able to be shown and do whatever it needs .
each time the app is being unlocked , it will send the intent of the home button to the real launcher the user has chosen .
of course , there are other solutions , but as i've tried , all of them have some kind of problem on some android devices and versions . they work by listening to the power off intent , and block the home button by using a flaw they've found in the android source code . you can never assume that it will work on all devices and android versions .
example of such apps are "widgetLocker" and "Picture Password Lockscreen"

Categories

Resources