How can I achieve the following Android manifest being generated:
<provider android:name="com.companyname.MyDocProvider" android:authorities="com.companyname.documents" android:exported="true" android:grantUriPermissions="true" android:permission="android.permission.MANAGE_DOCUMENTS" android:enabled="@bool/isAtLeastKitKat"> <intent-filter> <action android:name="android.content.action.DOCUMENTS_PROVIDER" /> </intent-filter> </provider>
The problematic part is this intent-filter. The following doesn't work:
[ContentProvider( new string[] { "com.companyname.documents" }, Exported = true, GrantUriPermissions = true, Permission = "android.permission.MANAGE_DOCUMENTS")] [IntentFilter(new[] { "android.content.action.DOCUMENTS_PROVIDER" })] public class MyDocProvider : DocumentsProvider { }
as the nested intent filter is not generated:
<provider android:name="md5c85863cfe94b914c5032f92db130591d.MyDocProvider" android:permission="android.permission.MANAGE_DOCUMENTS" android:exported="true" android:authorities="com.companyname.documents" android:grantUriPermissions="true" />
I also tried to find a possibility to put it directly into manfest file but I don't know the target package name (this md5Something) and I couldn't find is there any placeholder that can be used in AndroidManifest.xml.
Posts
I was unable to decorate it with attributes or put some placeholder into AndroidManifest.xml.
Instead, this https://developer.xamarin.com/api/type/Android.Runtime.RegisterAttribute/, lets me control the name of the generated class.
Plus manually populated provider in the manifest file and it works great.
@RafalGrzybowski.9433 would you mind sharing your solution in more detail?
I'm curious how your solution is different than the requirements in the monodroid sample project in which the attribute was set in the
AndroidManifest.xml
here.@cwphilli you are right. I have compared the linked sample to our project and I have found we had a name mismatch in the manifest, so that it was not replaced during build automatically.
Thanks for sharing