I know this has been asked as found USB Device Access on S/O. Additionally finding resource of USB Host connectivity. And even context Activity Declaration in Android Manifest here, so I have looked.
To clarify, this is to support a USB SmartCard Reader device attached to an Android device.
I am trying to create a stand-alone library that can be integrated with another Xamarin/Android application, but not providing full source to the library itself. That said, I created a new Solution "TestXamLibs". In it are the default two projects...
TestXamLibs
TestXamLibs.Android
My additional separate project that will be used as a Resource library (for context) is
XamCACReader
Having said that, the basic premise to summarize the others. I have a Xamarin/Android application that will utilize a USB device that can get attached and removed. The app itself which is not much more than a skeleton app of opening screen and a BroadcastReceiver to handle the listening and handling when such device is attached/detached.
When attached, I have to keep requesting permission to use the USB device over and over.
These other web posts identify how to handle it so you dont have to keep responding... YES, allow it again by applying some sugar within the application's manifest.
While trying to add that component, the program wont run. Remove it, and it runs. HOPEFULLY, something stupid simple. One additional caveat, I am working in Visual Studio and see the "Resources" folder in the project, but so many other places refer to the "res" folder explicitly and dont know if there is something else I am missing, or just because of the IDE of Visual Studio vs other Android based IDE.
Anyhow, below is the entire manifest including what I TRIED to implement to stop the nag prompting.
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
package="com.companyname.testxamlibs">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30" />
<application android:label="TestXamLibs.Android"
android:theme="@style/MainTheme"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application>
<activity>
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@drawable/MyUsbDevice" />
</activity>
</application>
</manifest>
Then, in the Resources\Drawable folder, I added the "MyUsbDevice.xml" and its content below.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<usb-device vendor-id="2278" product-id="13367" />
</resources>
Now, based on above, manifest, as it exactly sits above, when I try to run, I get a failure of
Severity Code Description Project File Line Suppression State
Error Missing 'name' key attribute on element activity at AndroidManifest.xml:34:5-39:16 TestXamLibs.Android
Another time I tried and had more information, but still did not work, it was nagging about
android:debuggable must be set to true
and obviously not able to debug.
Aside from needing the assistance to get this manifest correct, is there some other way directly within code that can bypass what this manifest is allowing otherwise? As having seen all the posts about same context, you might think there was another way.