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

Can't find ContentProvider, share not possible! #33

Closed CARIVASH closed 5 years ago

CARIVASH commented 5 years ago

Hi I trying to share a ScreenCapture in Unity and I have all these permissions to Android and not works.

`

`

And when I push the button to share send me this error in Logcat: E/Unity: Can't find ContentProvider, share not possible!

yasirkula commented 5 years ago

Did you add the <provider ... /> to your AndroidManifest?

CARIVASH commented 5 years ago

Did you add the <provider ... /> to your AndroidManifest?

I Did it: <provider android:name="com.myCompany.MyAppName" android:authorities="CustomName" android:exported="false" android:grantUriPermissions="true" />

CARIVASH commented 5 years ago

Did you add the <provider ... /> to your AndroidManifest?

I Did it: <provider android:name="com.myCompany.MyAppName" android:authorities="CustomName" android:exported="false" android:grantUriPermissions="true" />

Yeah you're right, because I replaced into : android:name="com.yasirkula.unity.UnitySSContentProvider" with android:name="com.myCompany.MyApp" That was what would not let me share.

jyoti22 commented 5 years ago

Hello, When clicking on the app for taking screenshot and record video, I always get the error "Can't find ContentProvider, camera is inaccessible". Please guide me how can I fix the issue.

Thanks

yasirkula commented 5 years ago

Can I see you AndroidManifest?

jyoti22 commented 5 years ago

Hello, Below is the AndroidManifest - <?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.NativeCameraContentProvider" android:authorities="blabeeyProduct" android:exported="false" android:grantUriPermissions="true" />

Please guide me.

Thanks

yasirkula commented 5 years ago

You need to add a provider for the NativeShare, as well. NativeCamera's provider won't work for NativeShare. But make sure to give separate android:authorities to each provider; e.g:

<provider
  android:name="com.yasirkula.unity.UnitySSContentProvider"
  android:authorities="blabeeyProductTwo"
  android:exported="false"
  android:grantUriPermissions="true" />
jyoti22 commented 5 years ago

Hello, Currently, I am working on taking screenshot and record video when clicking for record video that content provider issue come.

jyoti22 commented 5 years ago

here is share AndrioiManifest - <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.j.UnityNativeShare" 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">

  <provider

android:name="com.yasirkula.unity.UnitySSContentProvider" android:authorities="blabeeyProductTwo" android:exported="false" android:grantUriPermissions="true" />

for recording and sharing both have content provider issue.

yasirkula commented 5 years ago

Can I see the contents of Assets/Plugins/Android/AndroidManifest.xml? Please paste all of its contents here. You can also e-mail it to me, if you like.

jyoti22 commented 5 years ago

Hello, For unity android share I am using this project - https://github.com/yasirkula/UnityNativeShare

For unity android video recording I am using this project - https://github.com/yasirkula/UnityNativeCamera Please have a look.

Thanks

On Tue, Mar 19, 2019 at 7:59 AM Süleyman Yasir KULA < notifications@github.com> wrote:

Can I see the contents of Assets/Plugins/Android/AndroidManifest.xml? Please paste all of its contents here. You can also e-mail it to me, if you like.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/yasirkula/UnityNativeShare/issues/33#issuecomment-474409318, or mute the thread https://github.com/notifications/unsubscribe-auth/AHPcbAJdFEjvHEPNv1qMLvB__BdO1xgKks5vYPtfgaJpZM4YRHRu .

yasirkula commented 5 years ago

Can I see the contents of Assets/Plugins/Android/AndroidManifest.xml? I want to verify that the AndroidManifest is set up correctly. Please paste all of its contents here. You can also e-mail it to me, if you like.

ghost commented 5 years ago

I had exactly same issue, but fixed it when rearranged my andoid manifest in test projects.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.Test.TestProduct" 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="@mipmap/app_icon" 
    android:label="@string/app_name" 
    android:isGame="true" 
    android:banner="@drawable/app_banner">
      <activity 
        android:name="com.unity3d.player.UnityPlayerActivity" 
        android:label="@string/app_name" 
        android:screenOrientation="fullSensor" 
        android:launchMode="singleTask" 
        android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" 
        android:hardwareAccelerated="false">
          <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
          </intent-filter>
        <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
      </activity>
      <provider
        android:name="com.yasirkula.unity.UnitySSContentProvider"
        android:authorities="blabeeyProductTwo"
        android:exported="false"
        android:grantUriPermissions="true" />
    <meta-data android:name="unity.build-id" android:value="4f068475-2840-420d-93b3-646c381781a3" />
    <meta-data android:name="unity.splash-mode" android:value="0" />
    <meta-data android:name="unity.splash-enable" android:value="True" />
  </application>
  <uses-feature android:glEsVersion="0x00020000" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
</manifest>

This is how my manifest look in test project, where I reproduced same issue and it's works after I put in link to library