yasirkula / UnityNativeShare

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

Problem with sharing "No apps can perform this action" #161

Closed ehsan-mohammadi closed 1 year ago

ehsan-mohammadi commented 1 year ago

Description of the bug

After calling the Share() method, it shows No apps can perform this action popup. I didn't use the AddTarget() method for sharing on a specific app. I think it's not a bug in the NativeShare library. But maybe we should do some changes in the AndroidManifest.xml file or something like that.

image

Platform specs

Additional info

There is no error in my console, and this is my code:

NativeShare share = new NativeShare();

if (!string.IsNullOrEmpty(data.description)) share.SetText(description);
if (!string.IsNullOrEmpty(data.title)) share.SetTitle(title);
if (!string.IsNullOrEmpty(data.subject)) share.SetSubject(subject);

share.Share();
yasirkula commented 1 year ago

Hi, did you modify NativeShare's source code or NativeShare.aar in any way?

ehsan-mohammadi commented 1 year ago

@yasirkula No, I didn't.

yasirkula commented 1 year ago

Hmm, does the example code have the same issue: https://github.com/yasirkula/UnityNativeShare#example-code. On which devices did you test the code?

PS. Is the plugin up-to-date?

ehsan-mohammadi commented 1 year ago

@yasirkula Yes, I tested your example code in my project and still have this problem. Also, I downloaded the latest version of NativeShare. Previously, I used NativeShare in this project and it worked. But this month I find out this problem occurs. I did some changes in the project for supporting new android version (13) and think maybe it's the cause of the problem. But I don't know do you have any idea about it?

Edit: I tested the example on Sumsung A51 (android 13) and Samsung A52 (android 12)

ehsan-mohammadi commented 1 year ago

@yasirkula It's strange behavior, but I tested your example code and this time it works on another device. I don't know does this problem occurs on some specific devices or not, but try to test my project on some other devices and send you the feedback.

yasirkula commented 1 year ago

Are you using AndroidJavaClass to modify NativeShare's any of the native static variables? If you didn't update the plugin from GitHub, can you do so? Package Manager is buggy on some Unity versions.

ehsan-mohammadi commented 1 year ago

@yasirkula Hi and sorry for the delay. No, I didn't modify any of the native static variables. But this time I tried to download the latest version of NativeShare from GitHub and currently the problem was solved.

Thanks for your help.