i'm working on a lock screen app for android , i want to make my app as the default lock screen app for mobile instead of the current lock screen .. how is that done programmatically ?
any help ?
You cannot replace your lockscreen app with default lockscreen. What you can do is, you can make your app work as a lockscreen. User will have to disable all default locking mechanism (pin, gesture etc.). And your app will be triggered every time user switches on the screen. That's how other lockscreen apps (like Go Locker etc.) work.
Related
iam developing screenlock app for android using a React Native and a little annoyed with the screen pinned dialog that always appears, is there a way to just get rid of it? so what I really want is no dialogue interaction at all with the user
enter image description here
If you're calling startLockTask() and your device isn't set up as a dedicated device with your app whitelisted, then no you can't prevent it:
Otherwise, the current task will be launched into screen pinning mode. In this case, the system will prompt the user with a dialog requesting permission to use this mode. The user can exit at any time through instructions shown on the request dialog.
The dialog is there to help users understand what's happening, give permission for the app to take over their screen, and know how to get out of it later. It's baked into Android by design, so malicious apps can't cause problems - it's just a limitation you have to deal with, unless you're working with a dedicated device (which can be set up to give apps more control and users less)
Have you thought about immersive mode instead, where you hide the nav bar? The user can get out of that too by swiping to reveal the controls, but it's less intrusive. There's no way to automatically lock the user's screen with no interaction though
I want to put a lock icon to my app. How can I do that programmatically as in some social apps like in the following picture? I want to prevent the user from clearing my app from recent screens or task as it's using services in the background and Oppo, Mi and Lenovo kills it. I already tried it but it didn't work for me
startLockTask();
Firstly, that lock is not implemented by Whatsapp or any other social networking site. That lock is set by the user manually.
And what does that Lock do is whenever the user clears RAM, then all the applications that are locked will not be killed if that (app) is either in the foreground or background. So that's nothing to do with the code of that particular app.
Now, quoting this line: I want user to prevent from clearing my app from recent screens.
Users can still clear any of the locked apps manually. That means if they swipe any locked app, then that app will be cleared. That lock only prevents the clearing of app when the user taps on clear RAM.
All in all, You can't set that kind of lock programmatically in any of your apps.
I installed an app on my android phone to safe lock certain apps with a password. Since I installed it, sometimes, regardless what i'm doing on the phone/which app i'm using, a full size screen with advertising appears and I have to click an "X" to close it or press back/home button.
(Can be that this screen appears randomly only when I digited a password to unlock an app therefore the safe lock app was active let's say, not sure.)
I was anyway wondering what sort of code is used for this? Anyone?
I'd need it for a less despicable cause: in order to show a transparent view with alertdialog when my timer is up and the app is closed, to imitate the original builtin countdown timer.
i am using kiosk mode in my android app. Here kiosk service should be called every two second and the app open for every two seconds. My app needs to access gallery or camera app. But my app does not let me access these things because every two seconds it comes to foreground if we try to go to other applications. Now my problem is i need to access camera and gallery in kiosk service which should be called for every two seconds.
Afaiu you are using background service which runs continuously in gap of 2 second.
Instead of using background service i would suggest you should use screen pinning option for android lollipop or more devices. To get more information regarding this you can read http://www.sureshjoshi.com/mobile/android-kiosk-mode-without-root/ .
Also ,you have to make your application a launcher application,so that everytime user presses the launcher icon your application starts.
To disable power on/off button you can use System Dialog Disable feature.
By using this you can get following benefits :-
1) Power consumptions/Memory usage is minimized.
2) According to your usage you can disable/enable the kiosk mode.
3) You can start the other application from your application by disabling the kiosk mode application.
Regards
Ajay
Is there any programming tricks that makes your application unclosable?
For example: You touch the back or the home button, but they don't do anything.
Or at least is there a way that your application blocks some applications to open?
I don't think you can stop user from moving your application to background unless it's some kiosk mode app. And the method to do that is to become device administrator and override all possible callback methods - home, back, settings, notification area etc.
If you just want to prevent your app from getting closed due to user activity you can show a persistent notification. This will allow you app to run in background even if user presses home button.
Make a launcher/Home screen app:
When users click the home button, your app will show.
You control ALL apps that can be started
On devices running android lolipop, you can use the screen pinning option available in your ROM.
NOTE: This is ROM feature, you don't have to do anything in your app.
See this great article about it.
yes its to get set the on backpressed method to.
moveTaskToBack(true);
finish();
Are you trying to hack in android OS ? Let me tell you that android apps are sandboxed, which isolates your app data and code execution from other apps.