Ionic 离子v3社会共享插件不工作android API 30

kadbb459  于 2022-12-08  发布在  Ionic
关注(0)|答案(2)|浏览(144)

在Android API 30中构建后,在Android 11中,共享不再工作
第一个

wz3gfoph

wz3gfoph1#

The query all packages permission is not given to all apps. Your app may get rejected by the play store if it doesn't justify permission use.
you can add <queries> to detect specific apps which accept the intent of sharing your content type.
The below example in config.xml is for requesting packages which accept plain text or images.

<config-file parent="/manifest" target="app/src/main/AndroidManifest.xml">
    <queries>
        <intent>
            <action android:name="android.intent.action.SEND" />
            <data android:mimeType="text/plain" />
        </intent>
        <intent>
            <action android:name="android.intent.action.SEND" />
            <data android:mimeType="image/*" />
        </intent>
    </queries>
</config-file>

If it is sharing with only a specific app, you can add a query with its package name .

<config-file parent="/manifest" target="app/src/main/AndroidManifest.xml">
    <queries>
        <package android:name="com.whatsapp" />
    </queries>
</config-file>
7uhlpewt

7uhlpewt2#

解决方案在android平台的config.xml中添加以下内容

<platform name="android">
     <config-file parent="/manifest" target="app/src/main/AndroidManifest.xml" xmlns:android="http://schemas.android.com/apk/res/android">
      <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
     </config-file>
    </platform>

相关问题