androidManifestTemplate function

String androidManifestTemplate(
  1. String fileExtension,
  2. String mimeType
)

Implementation

String androidManifestTemplate(
  String fileExtension,
  String mimeType,
) {
  return '''
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data android:scheme="file"/>
                <data android:host="*"/>
                <data android:pathPattern=".*\\.$fileExtension"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:mimeType="*/*"/>
                <data
                    android:host="*"
                    android:scheme="content"
                    android:pathPattern=".*\\.$fileExtension"/>
                <data
                    android:host="*"
                    android:scheme="file"
                    android:pathPattern=".*\\.$fileExtension"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data
                    android:host="*"
                    android:scheme="file"
                    android:pathPattern=".*\\.$fileExtension"
                    android:mimeType="text/plain"/>
                <data
                    android:host="*"
                    android:scheme="content"
                    android:pathPattern=".*\\.$fileExtension"
                    android:mimeType="text/plain"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data
                    android:host="*"
                    android:scheme="file"
                    android:pathPattern=".*\\.$fileExtension"
                    android:mimeType="application/octet-stream"/>
                <data
                    android:host="*"
                    android:scheme="content"
                    android:pathPattern=".*\\.$fileExtension"
                    android:mimeType="application/octet-stream"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data
                    android:host="*"
                    android:scheme="file"
                    android:pathPattern=".*\\.$fileExtension"
                    android:mimeType="$mimeType"/>
                <data
                    android:host="*"
                    android:scheme="content"
                    android:pathPattern=".*\\.$fileExtension"
                    android:mimeType="$mimeType"/>
            </intent-filter>''';
}