Xamarin Android C#: Using the xml resource folder and manifest to define an intent filter for detecting connected usb devices crashs application -


hope day good!

i have followed step step guide in android development guide detecting connection of usb device here: http://developer.android.com/guide/topics/connectivity/usb/accessory.html (in c# xamarin though not java , going intent filter path automatically detect device via broadcast receiver)

needless say, did not work out expected , caused app crash when started up.

after quite few hours have managed pinpoint @ least 1 of problems there may more. problem if create "accessory_filter.xml" in xml folder (that created) in res folder app crash no matter what. if code not use @ all, xml file exists app crash straight after starting.

any help, advice or assistance appreciated! thank you.

edit: android manifest

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="scout.app" android:versioncode="1" android:versionname="0.0.0" android:installlocation="auto">     <uses-feature android:name="android.hardware.usb.accessory" />   <uses-sdk android:minsdkversion="19" android:targetsdkversion="19" />     <uses-permission android:name="android.permission.internet" />     <uses-permission android:name="android.permission.restart_packages" />     <uses-permission android:name="android.permission.read_external_storage" />     <uses-permission android:name="android.permission.write_external_storage" />     <uses-permission android:name="android.permission.read_sms" />     <uses-permission android:name="android.permission.receive_sms" />     <application android:label="myapplication">     <activity android:name="mainactivity">             <intent-filter>                 <action android:name="android.hardware.usb.action.usb_accessory_attached" />             </intent-filter>             <meta-data android:name="android.hardware.usb.action.usb_accessory_attached" android:resource="@xml/accessory_filter" />         </activity>   </application> </manifest> 

and accessory_filter.xml:

<?xml version="1.0" encoding="utf-8" ?> <resources><usb-accessory model="modelname" manufacturer="me" version="1.0"/></resources> 

xamarin works little different here. instead of writing intent filter manifest, should add annotations activity.

a read xamarin documentation topic.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -