小编Not*_*ote的帖子

无法从其他应用程序访问自定义内容提供程序

我有 2 个应用程序,我希望应用程序 A 通过内容提供商与 B 共享数据,我可以访问应用程序 A 中的内容提供商,但不能访问应用程序 BI 中的内容提供商,感觉我的权限混乱,但不知道如何修复它。这是我的文件...应用程序 A 的清单文件:

 <permission android:name="myper.READ" android:protectionLevel="normal"  />
<permission android:name="myper.WRITE" android:protectionLevel="normal"  />

<application
    android:name=".ui.MyApplication"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/Theme.Ex">

    <activity android:name="com.abcd.aaaaa.ui.MainActivity"
        >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <provider
        android:authorities="com.advance.usercontentprovider"
        android:name=".contentprovider.UserContentProvider"
        android:enabled="true"
        android:exported="true"
        android:multiprocess="true"
        android:readPermission="myper.READ"
        android:writePermission="myper.WRITE"
    />
</application>
Run Code Online (Sandbox Code Playgroud)

和 B 的清单文件:

<uses-permission android:name="myper.READ" />
<uses-permission android:name="myper.WRITE" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/Theme.aaaa">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>
Run Code Online (Sandbox Code Playgroud)

自定义内容提供商: …

android android-contentprovider kotlin

1
推荐指数
1
解决办法
1262
查看次数

标签 统计

android ×1

android-contentprovider ×1

kotlin ×1