I'm working on android application which have one service runs in background,
I need to make sure that the user will close the app/service only upon inserting password (like app lock on the market only for the service and the app).
Any ideas suggestion of how to implement such a feature?
On android 2.3 isn't possible the user will kill your app, but starting with Android 4.0 and Device Administrator it is: reasonable. Take a look at Kaspersky's parental control app.
Related
I want to know from your experience what are the best practices for remotely block/hide Android App?
With iOS you can hide certain (or all) apps with iOS profile and push the profile to iOS using MDM Server (if iOS in supervised mode)
Some people suggest creating an android app that monitors the foreground app and creates an overlay on top of it. do you think about this?
Let me tell you briefly about this because i did these type of things in past.
We can hide only our app in user mobile,we can't hide other apps in user mobile but we can block any app in user mobile. For this you can use any way either statically or dynamically(via server)
Now the question is how ? So here is the answer
You need to run background and foreground both service. Now detect the app (package). It means you need to detect whether app is in foreground or in background.
So if the app is in foreground then you need to close/block the app.
Now the another question is how we can close/block the app ?
Suppose you want to close/block Facebook app in user mobile then use condition like
if (packagename.equals("com.facebook.katana"){
Intent startMain = new Intent(Intent.ACTION_MAIN);
startMain.addCategory(Intent.CATEGORY_HOME);
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(startMain);
}
You need to use above code in service. Service will detect continuously whether Facebook app is in foreground or not. You can use timer or thread for this.
As soon as the service gets the Facebook Open then service will fire intent to Home Screen.
Above is the best possible way to close/ block the apps.
Thanks!
Do you plan to use it on your own devices?
If so, you can create an app that will be started when you boot the device that will control running tasks. And when you detect the app you wish to kill, the service will kill it. You can create remotely configuration about which apps you blacklist using Firebase RemoteConfig functionality. https://firebase.google.com/docs/remote-config/
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.
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.
I am a newbie on android apps development, I want to make a application which can lock any application when started. For eg if someone opens chrome or any other application it simply locks it.
Maybe you will not get any straight forward solution for that.you have to create a service that will run on the background.You can check periodically to find therunning process.Then you can find the package name for the process which you want to kill.Finally use killBackgroundProcess of the ActivityManager to kill the process.This method only kill background process.So if you want to stop browser that starts running simply send that in background(If you bring your activity in foreground it automatically will be back) and run the killBackgroundProcess(pkgName).
Android now allows users to add app widgets to the lock screen form API level 17, i dont know backward comparability supports or not
We want to use Android mobile for dedicated application. Can somebody suggest how can we make it happen.
Here are the requirement:
The phone when started, should launch our application., so the user cannot launch any other application. The application will be a 1D barcode reader.
The application should be live as long as the phone is up and running, user cannot close the application at all.
Thanks for your help.
Regards,
Manish
Android after boot is complete sends a bradcast intent:
android.intent.action.BOOT_COMPLETED
if you listen for this intent, you can launch a service that in turn launch your activity.
In the Activity you have to take care of the user's interactions that explicitly close the activity, like home button, back button and camera button press.
Setting your activity to be full-screen also should prevent the user to use the notification bar to interact with notification like those from market-app that can close your activity.
Finally, your activity can be killed by the system by various and uncatchable reasons: in those cases, the service that first launched your Activity comes in handy, as it can periodically monitor the general state of the application and relaunch components as needed.
Check out the new Android Enterprise solutions for your use case.
https://developers.google.com/android/work/overview
Its well documented. You can either use
Android Management API to provision the devices and apply policies to the device which will be applied to the device using Android's Device Policy Controller (DPC) or,
Use Google Play EMM API and develop your custom DPC
It depends upon your use-case really, but the first solution set should serve your purpose
I'm afraid there's no single answer to this, but you need to work on multiple fronts.
One of these fronts is preventing user from running other applications: for this there are applications sold on Android Market that can put other apps of your choosing behind passcode.
You need to combine this with automatic launch, but I don't yet know how to do that.