perform a task when any application installed on device is opened? - android

I wish to filter the applications installed on the device so that the person, using that device can't open any app rather than few basic apps... or i wish when he/she opens any application password will be asked......

That somewhat of a more low level task. I guess you will have to either root the device, or build your own System image and install that on your device.

By reading 'Logcat' logs in the background we can detect other applications launch; as working of any lock application.

Related

Can I launch a specific app when android device get physically connected to a specific usb device?

Can I "register" a (already installed) specific app to be launched when android device get physically connected to a specific usb device ?
Eg.
I connect a keyboard (of a certain brand or with a special USBid/class) and it automatically launch a text editor app
I connect an USB soundcard and it launches an audio app.
And "better", is there an autolaunch on Android ? I plug a keyboard+storage device to my smartphone and Android will ask me if I want to install the apk from the storage (or download it from predefined url)
Obviously for security reasons I understand installing the app from the storage will need confirmation by user. But, once the app has been "registered" would it be possible to launch the app automatically without having a confirmation screen ?
I know I could get USB info with android.hardware.usb.usbdevice. My question is more about how I can tell Android to launch this app rather than another when usb device is connected.
I think you could register your app to receive a system broadcast like USB_ACCESSORY_ATTACHED and make the logic to launch your app when this happens.
Check https://developer.android.com/guide/components/broadcasts
https://developer.android.com/reference/android/hardware/usb/UsbManager.html#ACTION_USB_DEVICE_ATTACHED

What is the Difference between a Device Policy Controller (DCP) app and a System App?

Is there any difference in the privileges of an Android DPC application and a system application? Will a system application be able to perform all the functions that a DPC can perform such as setting the device to Single Use Mode?
Well, there is no-such difference in privileges as far as the Android system is concerned.
If you look at the Android Platform Architecture, you will find that the even a normal user app have the same access to all the system resources as a system app.
Apps included with the platform have no special status among the apps the user chooses to install. So a third-party app can become the user's default web browser, SMS messenger, or even the default keyboard (some exceptions apply, such as the system's Settings app).
You can read about more differences in system and user app here.
Also, another interesting point to note is that on a production device there are only 3-processes that run as root, the Zygote, the app_process and the adbd (though it doesn't allow root access directly using adb). That means, all other apps run under their own user_id with different permissions and since Android doesn't differentiate between apps, two apps having same permissions are allowed same privileges and access to resources, regardless of the fact whether it is a system app or a user app.
Now, to answer your question, if a system app has the same privileges as the DPC app, then yes the app would be able to perform the given task (like setting the device to Single Use Mode) same as the DPC without any problem.
As a side note, if you are planning to create a DPC for you organisation, using the DPC SUpport Library is better than creating and shipping a system app.
P.S. To change a System setting your app would need the WRITE_SETTINGS permission.

How to make an android mobile only running an application from startup?

Well, today in my workplace i have been given a task. Boss handed me an android mobile, which only runs a application and nothing else. Whenever the mobile starts, it starts the application and users cant nvaigate anywhere from that application. which means the mobile is only dedicated for that application. An ex-employee did this thing.
I need to bring it to normal condition. Then do the same for another application, which is only my application will run in the mobile, as its doing for another app.
How to solve it? Can anyone please help me?
If you do not care about the data stored on that mobile then you should perform the factory reset. This will bring your mobile to the fresh state with only OEM apps installed.
To do it you need to enter the recovery mode. If your device has USB debugging mode enabled then simply connect it to the computer and type adb reboot recovery. If debugging is not enabled then you have to force the recovery mode then you should do a research on the internet how to put your device in recovery mode. For example for Samsung devices you have to turn off the device and then hold Home+VolumeUp+Power buttons.
Once you enter the recovery mode you will see few options. One of them is "wipe data/factory mode" (see example here). Use volume buttons to navigate through options and power button to accept the option (note that touchscreen is not operable in this mode). Remember that this will erase all your data and you will not be able to restore it. No turning back beyond this point.
After the reset you will have no custom apps installed so you can install whatever you want.
If you cannot do the factory reset because you do not want to lose your data then there is other, more difficult option, that requires some Android programming. You can simply write an application that would:
run at startup
get information about installed packages
find the application that has been blocking the device
send an intent that would ask the user if he wants to uninstall the app:
Uri packageURI = Uri.parse("package:"+"some.package.to.remove");
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
startActivity(uninstallIntent);

How install/uninstall application without user interaction in android without rooting device programatically

I need source code in install/uninstall application without user interaction like it will uninstall in background in non rooted android device. No user interaction .Silent uninstall/install android application.
It can't be done. App must display the permissions it require to the user before installing on the device.

Android system app as device administrator without user activation

I want to build an android service that uses the Device Administration Api (http://developer.android.com/guide/topics/admin/device-admin.html).
The problem is that i dont want the user to enable my service. I know that this is not possible for a regular application by i am cooperating with an oem so i am going to use a custom rom and my application can be a pre-installed system app.
So my final question is if a system app with the right permissions is able to use Device Administration Api without needing user activation of the app as device administrator. If this is possible can someone tell me how this is done? Please help me.

Categories

Resources