用我的Android应用程序打开特定文件

问题描述 投票:1回答:1

当我单击扩展名为“ play”(someFileName.play)的文件时,我试图打开android应用程序。我的问题是我单击哪种文件都没有关系,它提供了使用我的应用程序打开文件的选项。这是我的“ Manifest.xml”:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.play">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:launchMode="singleTask"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
         <!-- custom file start -->
        <intent-filter
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name">
            <action android:name="android.intent.action.VIEW" />
            <action android:name="android.intent.action.EDIT" />
            <category android:name="android.intent.category.DEFAULT" />
            <!-- change custom file extension -->
            <data android:mimeType="*/*" />
            <data android:host="*" />
            <data android:pathPattern=".*\\.play" />
        </intent-filter>
        <!-- custom file end -->
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>
</manifest>

需要帮助修复它,请帮助。

android android-manifest react-native-android manifest
1个回答
0
投票

尝试更改为:

        <!-- change custom file extension -->
        <data android:mimeType="*/*" 
              android:host="*" 
              android:pathPattern=".*\\.play" />
© www.soinside.com 2019 - 2024. All rights reserved.