I'm developing an android app that must communicate with a usb device. I read the docs at http://developer.android.com/guide/topics/connectivity/usb/host.html, and added an intent filter and a device list. After that my app detects the device when I plug it in and offers to start the app automatically. If the app is already running when the device is plugged, or if the device is already plugged when I start the app, there are problems.
If the app is already running I get a new blank window. I suspected it started another instance and added android:launchMode="singleTask" to my manifest, but the behavior did not change. I think I get an error message about a surface view as well, but I don't have it at hand now.
If the device is already plugged when I start the app, I get a permission error when I try to open the device.
The behavior I would like is: - If dev attached when app not running, start the app - If dev attached when app running, detect it and enumerate devices - If dev detached when app running, detect and handle it in my code
Should all this be doable just with the intent filter if I do it correctly?
I'm developing the app with Qt, and using JNI to interface java code handling the usb stuff, if that is relevant info.
0 comments:
Post a Comment