Disable provision mode - java

I have provisioned my tablet with my own application now I want to remove it from the provision programmatically without loosing any data.
I have used adb commands but it is not working on click event.

Related

Android kiosk application - Shutting down unwanted applications

I'm creating an Android kiosk application, a launcher application. The application shows apps that are allowed to be used by the user. I want to prevent the user from opening unwanted application (like recent apps, settings etc). So I've build a service (KioskService.class) which checks if the active activity is on the list of allowed applications. This is done with a Thread (So it checks even if another applciation is opened)
At this moment when an unallowed application is opened I return the kiosk application. What i want is that the previous activity is reopened.
So for example. When I open the Calender application (which is an allowed application) en then I open the setting from the Notification bar, the application needs to return to de Calender activity.
Thanks in advance,
T
First you will need root privileges, then try the below steps:
1) run a daemon service to constantly monitor which app is currently used by user. this can be achieved by getting the foreground app's package name.
For getting foreground app's package name use this code:
ActivityManager mActivityManager =(ActivityManager)this.getSystemService(Context.ACTIVITY_SERVICE);
if(Build.VERSION.SDK_INT > 20){
String mPackageName = mActivityManager.getRunningAppProcesses().get(0).processName;
}
else{
String mpackageName = mActivityManager.getRunningTasks(1).get(0).topActivity.getPackageName();
}
2) compare the package to your white list apps. If the current app is not in your list then kill it with the below code:
Process process = Runtime.getRuntime().exec("adb shell am force-stop packagename");
process.waitFor();
3) to prevent user navigating using notification bar or navigation button, you can kill the system UI process and make your own implementation of navigation buttons similar to floating buttons.
Shutting down other applications may cause a security issue for you.
The Android docs state
Your application runs in a secure sandbox environment, so other processes on the system cannot access your code or private data.
Ergo, trying to shutdown other apps from your own Service may not a viable option.
You could however bring your own app back to the foreground if another app is started?
Edit:
This looks like an interesting tutorial on how to build a kiosk app.
The approach is also interesting, as in your app starts on boot, so doesn't give opportunity for the user to launch another app,
What #Zain has given is a wonderful tutorial. I have gone through it.
If you want to disable other applications, you can do it with adb shell command.
adb shell pm list packages - will list all packages
and
adb shell pm hide com.the.packagename - will disable any package.

Android automatically download and install apk

we have our android application which is running in kiosk mode. We would like to have feature to automatically check for updates, install those updates and run application again.
We can use some android service for that (actually, that's preferable way).
Do anybody has idea how we can accomplish that?
Thank you.
When the user has activated the auto update option in Play Store, then your update will automatically installed once the user has Wifi. If the user hasn't set this option you can do nothing about that.
You can ping your API every time your app starts, and your API has to tell you whether there is a new version. With this information you can display a popup to the user which forwards him to your PlayStore entry. But the user must select to update your app, you can not automate this process.
What you could do: If you write an HTML5 app, or you have a WebView which loads content from the network, then you can do your magic updates by simple updating the sources on server side.

Programmatically close a native application from another application

Basically, what I want to do is to close another app not created by me from my app. I haven't been able to find a solution but have learned that this is something many critizise as being a bad solution in general.
I do believe I have a good reason. What I want to do is to have an app that can recieve a file via PUSH OPP from another device that doesn't have an app installed on it. To be able to do this I have to disable the host-device's PUSH OPP application. I have to do this since I need to take over the default channel (12) for pushing files from the OS so that I have controll over the file-sending from the client. I can't use another channel since I can't have an app installed on the client and thus can't make it push the file via another channel. I know this probably is very bad practice but the device with the application will only be used for this specific application.
One way that seems to work is to manually disable the system's PUSH OPP application but this creates a hazzle when the user should install and use the app. They have to:
1. Install the app.
2. Every time they start the device they have to go into running applications and disable the standard PUSH OPP.
3. Run the app.
If I would be able to send a quit-command through my app to the native PUSH OPP app the default channel (12) would be freed up for me to use without the user having to go through step 2 every time. Is this even possible to do without root-access?
in your code, youcan use
system(“kill pid”);
get pid from /proc

Getting notification / listener when action is performed (chimpChat / monkeyrunner tool)

I want to get a notification if someone has performed an action in an android app from outside of the app. I don't want to make any (android) code changes. To do the actions I use the Chimpchat.jar, the .jar that the monkeyrunner tool uses.
To be clear: Can I get a notification or register listeners on components from outside of the app?
e.g.
Run my android app
My java application links into the device with chimpChat via the adb
The user touches a button
My java application gets a notification what was performed
=> am I able to get that information? If not, am I able to get the information on which position the tab was?
Hopefully it's clear what I want to do.
Thanks, soeren

Is it possible to implement a secure application to block internet on Android in roaming?

I need to develop an application that will check whether the phone is in roaming. If it's in roaming then the application should block internet for all applications except several from white list. In non-roaming mode it should allow all requests. There should be no way for user to kill or suspend the application or turn internet on.
I'm not familiar with android much so I really don't know whether it possible to implement without modification of OS. Is there any way to do this?
There is a system setting for this which is disabled by default.
For normal user phones - You cannot enable this setting programmatically.
For rooted phones - You can enable this setting programmatically provided your app is in the system apps folder
There's no way to tinker with the OS at a level where you can selectively enable and disable the accessibility of the network to certain applications. The only way out is to modify the OS.
DroidWall - Android Firewall is a front-end application for the powerful iptables Linux firewall. It allows you to restrict which applications are permitted to access your data networks (2G/3G and/or Wi-Fi).
http://code.google.com/p/droidwall/

Categories

Resources