Forum Xamarin.Android

Android DocumentsProvider intent filter

RafalGrzybowski.9433RafalGrzybowski.9433 USMember ✭✭
edited May 2017 in Xamarin.Android

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

Sign In or Register to comment.