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

Callbacks!!!!! #89

Closed Nameless77 closed 3 years ago

Nameless77 commented 3 years ago

first of all thank you so much for providing such an amazing plugin.worked like a charm but i have a question and that is, in my game i want to give some coins to the user for sharing my game on social media(like on whatsapp or twitter or facebook etc.) so how can i actually know that user shared my game link on social media.so i just wanted to ask that is there any way to figure out that user share the link of my game using NativeShare. if it possible then can you please tell me and can you give me a simple code example for doing that.

yasirkula commented 3 years ago

Please check out the SetCallback funtion here: https://github.com/yasirkula/UnityNativeShare#how-to. The example code at the bottom of the page uses that function.

Nameless77 commented 3 years ago

ok i successfully figured out that how to give rewards on successfull share. but when i see the log in console it shows me "Share result:Shared" but "selected app:blanck. so why this happen(just asking).is there any solution then please tell me.

yasirkula commented 3 years ago

Selected app may not always have a value, I assign its value only if OS provides that information. If that information is vital to you (in my opinion, it shouldn't), you can execute the following code in Start/Awake:

using( AndroidJavaClass ajc = new AndroidJavaClass( "com.yasirkula.unity.NativeShare" ) )
    ajc.SetStatic<bool>( "alwaysUseCustomShareDialog", true );

Now, the share dialog will look less pretty but the Selected App is more likely to have a value.

Nameless77 commented 3 years ago

ok that is also resolved and thank you so much for suggest me and ya share dialog become dark after applying your solution(well thats not a problem for me).so i just want to ask that will it affect share functionality in any way?

yasirkula commented 3 years ago

It shouldn't. If it does, it should be reported as another Issue.

Nameless77 commented 3 years ago

ok thanks you for your awesome support.now i am closing this issue