I'm working on a B2B app, using a USB device as part of the product.
We are running the app in a kiosk mode through an EMM provider and almost everything works nicely.
The only issue at the moment is that every time the tablet restarts or if the app is updated, the app will ask for permission to access the connected USB device.
Since we know exactly which USB device will be plugged into the devices (vendor-id and such), is there a way to allow the app to have permission to this specific usb device?
Through the EMM kiosk mode we can provide all other permissions automatically, except the USB permission.
Hope that someone can help me out, thanks!
Related
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
0
I've been using my app as a deviceOwner App since lollipop. I have a new device here which I want to be DeviceOwner too.
It is a Samsung galaxy Tab A 10.5(2018) SM-T590.
I am currently running this Version of the rom: T590XXU2ASC1.
I am not using NFC method. I usualy create the /data/system/device_owner.xml file by myself. But since it is not working I tryed this method:
1-Factory reset the tablet in recovery mode
2-Pass through the annoying startup menus
3-Set lock screen to none
4-Enable Usb Debugging
5-Install my app adb install MyApplicaton.apk
6-adb shell dpm set-device-owner com.example.myapplication/.MyApplicationReceiver It always says success when i execute the command.
7-Start my app, i can pin/unpin my app without problem.
8-Reboot, and then the famous message appears everytime: Workspace has been locked Unauthorized software has been installed on your device.Workspace has been locked to prevent any unauthorized access. Contact your admin.
Then if i press on the FACTORY DATA RESET button the workspace app crashes then pops back.
I tryed the kioskModeDemo app and the androidDeviceOwner sample app and they all do the same problem.
Anybody have any hints of why this is not working anymore on Android 8(oreo)?
Thanks
I found the problem: Once you oem unlock(custom os) your device on a certain samsung knox level API, you can't be device owner anymore on this device.
This is from Samsung Knox page: "Cannot create work profile" "The security policy prevents the creation of a managed device because a custom OS is or has been installed on this device". https://seap.samsung.com/forum-topic/knox-and-nfc-device-owner-provisioning
The device could be vulnerable to potential attacks with custom os.
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.
My device is such that my android app is always connected to an Arduino board through a USB. On device reboot my Android app forgets the USB permissions granted using intent filter in the manifest. I want my app to remember permissions for communicating with the Arduino board across power on/off cycles (Something that it is currently not doing).
So I found out that there isn't a way to go about it yet. So thank you for your time.
I'm developing an android app which uses USB OTG devices. The app "connects" to the device via the android USB API and I'm reading some volume information using an external library.
Everything works fine, but there is an user experience issue: The device is mounted by android, but when the connection from my app is established, the device becomes obviously unmounted for the operating system and a message like "USB storage removed unexpectedly" is shown.
I know, this is the right behaviour from androids point of view - but not from my users' :-)
Does anyone know about a possibility either to suppress the system message or doing any kind of workaround? Any ideas are welcome... I've read some SO tickets and don't think that there's a possibility to safely unmount the device programatically befoe connecting from my app.