Is it possible to lock the complete device from a flutter app? - android

I want to lock my android device as soon as a particular event happens in an application. The application will keep running in the background and lock the device as soon as the event happens. I tried plugins like flutter_screen_lock but they only provide locking within the particular app while I want the complete device to get locked.

Quick answer to your question this is not possible. If it would be possible both App Distribution Providers (App- and Play Store) would not accept your App because it would be against those Rules.

Related

Keep Flutter application active on device at all times, possible?

A client of mine is requesting for a very specific functionality, to keep the application always active, even after the user force kills it. He wants to ensure that the users have the application active at any time while using the device on which it is installed (the devices are managed in a constrained environment).
I've done some research on it, and already enabled background services for sending the user's location, but if they force kill the app then we are unable to send locations to the server. We've seen other apps do it, but wonder how they do it.
According to https://stackoverflow.com/a/34573169/640907 it should be possible in Android. We also found https://ssaurel.medium.com/how-to-auto-restart-an-android-application-after-a-crash-or-a-force-close-error-1a361677c0ce but I don't think this will work for our use-case, as the user can close the application without "force kill" aswell..
Anyone knows how to achieve this for a Flutter application?

Android notifications service

I want to know the process flow of android apps like i have an app in my device by which it blocks the apps in background. Eg - If the app is forbidding the whatsapp then there will not be any notification in the device untill and unless the app is opened by user.
I want to basic mechanism how the app is doing this as it blocks the apps and also disable data for that forbidden app.
You can not block notifications of any other Android Application or disable its background processes. You might be able to achieve that on a rooted device but that's something not appreciated.
Again if you want to disable data programmatically, you require a rooted device. You can read that here.
If you want to achieve Single-Purpose Device, read here.

How to detect lock and unlock of screen pinning on android

I am working on an android app that should be used by students in some kind of practical test.
I am using the screen pinning that was introduced in Lollipop (startLockTask()), so when my app is launched the user needs to allow the locking.
I couldn't find a way to know when the user click ok for the locking and when he unlock the pinning? (The user can cancel the lock by holding both the Back and Recent buttons).
I am not looking for a way to know if the user currently in lock screen (getLockTaskModeState ()), i want to know if i have a way to handle the events of locking or unlocking.
I want that in the begining of the test i will be able to send information to my server if the users 'logged in' properly (by allowing the lock), and as well if the user unlock the device before the end of the test.
EDIT
Hey, people!
Please explain yourselves after downvoting!
If I wasn't exaplaining myself - i will try again if you will let me know.
I read a lot of questions and answers about general lock screen, but not the one of app pinning, I also read about check the status of the current task- if it is locked or not, but i didn't find answer to what i am asking - is there a way to handle the event of unlocking the 'screen pinning' of a specific app.
So please, explain your downvotes!
Device Admin Recevier class give you the event of pinning and unpinning... However the example use the class when the installed app is provisioned for device owner.. Not sure if you could use it. You may refer to this too : How to be notified when screen pinning is turned off in Android 5.0 Lollipop?
https://developer.android.com/reference/android/app/ActivityManager.html#getLockTaskModeState()
Just use the function as stated in the link.

Android- programmatically restrict which apps can be run

I'm building an app that needs to restrict which apps can be run along with it.
In example, when my app is running (foreground or background) I can allow user to run only GoogleMaps, and MusicPlayer.
I've read a bit about Device Policy Controller and creating profiles, and up to some point it seems to have the feature I need, but it is designed for enterprise deployment, and user needs to encrypt their phone beforehand. Is creating personalized profiles a way to go?
My other idea was to run a service that each few milliseconds check if there is any forbidden app running and finish it, but it seems to be not robust.
Is there any way of handling this problem programmatically?
I don't think that Device Policy Controller is a right thing for you.
And you can't just kill other apps without root.
So some kind of user-friendly way to achieve the goal is to check running apps list with ActivityManager.getRunningAppProcesses and to notify user that he has to finish particular apps to use your app.

Make android app that is run as the only app on the android device.

I want to make an android app that runs as the only app on the android device. If the unit is reset I want this app to start up and run.
The reason for this is we are going to be buying these special 7 inch wall mounted tablets which have android OS on them (here is a link to the device: http://www.geekland.co/7-Android-42-Panel-PC-Wall-or-Desk-Mounted-Tablet-with-RJ45-GK-Q896.htm). And we are going to be programming an app that does various things.
However, it is imperative that the app cannot be exited and that if the system restarts, that app is what runs. We don't want random people messing with the device. We want to restrict everything just to that app.
Of course, maybe with an admin password you would be able to exit the app.
Can this be done somehow within an android app? Or does this call for, I don't know, making some new android OS clone or something? (something I'm not sure of how to do).
As I know there are few ways to do this.
Override buttons as in here
Write a home screen application as in here
Lock apps using apps similar to AppLock some can even lock system apps and settings
If the devices are running Lollipop or newer, you can do this with the Task Locking API. First you need to make your app (or some other app) the device owner and grant your app the lock task permission so that locking can be done without user confirmation. Then just add a receiver in your manifest for the BOOT_COMPLETED intent and lock the task when the app starts.
I wrote an open source app that acts as the device owner and simplifies granting lock task permission to your own apps.

Categories

Resources