yasirkula / UnityNativeShare

A Unity plugin to natively share files (images, videos, documents, etc.) and/or plain text on Android & iOS
MIT License
891 stars 131 forks source link

ContentProvider not found #26

Closed bigvanstudio closed 4 years ago

bigvanstudio commented 5 years ago

I am testing the plugin on Android and when I try to share a video, noting occurs. Using the monitor app to check the console, when I try to share the video, the log shows something like "ContentProvider not found!".

I added this AndroidManifest.xml in the Assets/Plugins directory:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" xmlns:tools="http://schemas.android.com/tools" android:installLocation="preferExternal">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <application android:theme="@style/UnityThemeSelector" android:icon="@drawable/app_icon" android:label="@string/app_name">
    <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    </activity>
    <provider android:name="com.yasirkula.unity.UnitySSContentProvider" android:authorities="[here I put my bundle indentifier]" android:exported="false" android:grantUriPermissions="true" />
  </application>
</manifest>

The same message is shown in the console and the video can not be shared. I have been struggling with this all the day and I do not find the problem..

Any idea?

Many thanks in advance!!

dvillaseca commented 5 years ago

you have to define the android:authorities variable you can find it on PlayerSettings(android)->other settings->packagename

yasirkula commented 5 years ago

You have to put AndroidManifest.xml into the Assets/Plugins/Android directory.

brijesh-brk commented 4 years ago

There may be missplacement of Manifest.xml. Make sure above file must be in Asset/Plugin/Android alongwith proper provider tag.

yasirkula commented 4 years ago

With the latest release, ContentProvider is automatically added to the AndroidManifest with a unique authorities string. So hopefully we will no longer encounter this issue.

P.S. Asset Store version isn't updated yet, only the GitHub version is up-to-date.