So I have an application that is pinned to the device with startLockTask command and it has several restrictions so the user cannot escape from the application or change settings of the device.
However, the user should be able to transfer files from the device to a computer via USB, but when the device is connected to a "new" PC, the USB permission dialog: Allow access to device data is not shown because of the LockTask mode.
Is there any way to open that dialog in front of my application?
Faced the same problem today,
in my case I solved it by adding com.android.systemui package, while adding my whitelist application's in setLockTaskPackages DPM's method.
After this I can see the dialogue which was blocking up in LockTask mode.
Related
I do no get my android java app working the way i want it to work.
If i plugin the device i get a permissions dialog to start the app. The app is started and i can open de device.
If i start the app and plugin the device after the i started the app i am able to set the permissions, and i get a permissions dialog.
But when the app is closed and restarted the permissions dialog to not showing anymore.
Problem is that i cannot open the device anymore.
The only way i can get things working again is by unplugging and replugging the device.
So what i want is to show the permissions every time i launch the app.
Is this possible ?
Or can usb devices only be obtained once after plugin ?
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
In an Android app, I need permission for a specific USB device (known vendor/product ID), which is permanently plugged on the Android device.
So far I've made the following observations:
when using UsbManager.requestPermission() the permission is dismissed when replugging/rebooting and the popup's checkbox seems to have no effect at all on this behavior
when using intent filters, the permission is properly re-granted when replugging the USB device (even when replugging after a reboot, if the popup's checkbox was checked) BUT the permission is not re-granted after reboot unless I unplug & replug the USB device.
Is it possible to make sure that the permission popup is displayed only once ? (especially in the scenario when the Android device is rebooted and the USB device remains plugged in)
NB: the app isn't installed in the system folder and therefore cannot use the MANAGE_USB permission.
The solution is to use intent filters and add the android:directBootAware="true" attribute on the associated activity so that the USB_DEVICE_ATTACHED event is correctly received after boot.
Persisting USB Permission is not possible, as the reboot option is stopping everything forcefully generally it makes the USB also unplugged.
There is one possibility to ask for replugging USB on reboot.
Is it possible to make sure that the permission popup is displayed only once? No
Because If your are connecting the usb which makes a deadlock situation for taking care of that they make it unplugged, rather than disturbing the system.
So it is not possible to make it USB Plugged-in.
I am trying to connect external fingerprint scanner to the Android application which is in Kiosk mode(Android COSU).
A system dialog should be displayed to ask for the permissions in order to access the fingerprint scanner. However, In kiosk mode, I cannot see any System dialogs showing up.
Is there a way where I can display system dialogs in Kiosk mode?
Edit: I am able to access Runtime permission dialogs but not Finer print authentication dialog. So, I guess there is some issue only with the USB permission dialog.
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);