android - Unity Share Button Implementation -


i'm trying implement share feature shown in blog: http://www.daniel4d.com/blog/sharing-image-unity-android/

but when tried share line on android got error: (http://triodigitalagency.com/line-error.png).

here relevant part of code:

//instantiate class intent androidjavaclass intentclass = new androidjavaclass("android.content.intent");  //instantiate object intent androidjavaobject intentobject = new androidjavaobject("android.content.intent");  //call setaction setting action_send parameter intentobject.call<androidjavaobject>("setaction", intentclass.getstatic<string>("action_send"));  //instantiate class uri androidjavaclass uriclass = new androidjavaclass("android.net.uri");  //instantiate object uri parse of url's file androidjavaobject uriobject = uriclass.callstatic<androidjavaobject>("parse","file://"+pathname);  //call putextra uri object of file intentobject.call<androidjavaobject>("putextra", intentclass.getstatic<androidjavaobject>("extra_stream"), uriobject);  //set type of file intentobject.call<androidjavaobject>("settype", "image/png");  //instantiate class unityplayer androidjavaclass unity = new androidjavaclass("com.unity3d.player.unityplayer");  //instantiate object currentactivity androidjavaobject currentactivity = unity.getstatic<androidjavaobject>("currentactivity");  //call activity our intent currentactivity.call("startactivity", intentobject); 

i've been pulling hairs 2 days find solution, sort of hint appreciated! (even if means need try other methods in implementing share feature).

thanks much!

do grant writing access external on player settings? try if not, image not create! :d

from author of code: grant writing access external (sdcard) in playersettings, otherwise won’t able share pictures.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -