Hi all!
struggling with updating gallery after adding rendered texture to it for few hours. Know there could find some answers for this question, but unfortunately from android 4, and currently not working…
(+) File is created in right localization, and can check it in FileManager (no issue here!);
(-) Can’t force gallery to scan its own file to update it’s content. Using this weird code found on stack overflow:
//REFRESHING THE ANDROID PHONE PHOTO GALLERY IS BEGUN
AndroidJavaClass classPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject objActivity = classPlayer.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaClass classUri = new AndroidJavaClass("android.net.Uri");
AndroidJavaObject objIntent = new AndroidJavaObject("android.content.Intent", new object[2] { "android.intent.action.MEDIA_MOUNTED", classUri.CallStatic<AndroidJavaObject>("parse", "file://" + m_dataPath + _todayFolder) });
objActivity.Call("sendBroadcast", objIntent);
//REFRESHING THE ANDROID PHONE PHOTO GALLERY IS COMPLETE
this code generating error:
Autoconnected Player
AndroidJavaException:
java.lang.SecurityException:
Permission Denial: not allowed to send
broadcast
android.intent.action.MEDIA_MOUNTED
from pid=9650, uid=10288
Also tried to replace:
android.intent.action.MEDIA_MOUNTED
with:
ACTION_MEDIA_SCANNER_SCAN_FILE
but without result, maybe someone could help with this issue (BTW calling it feature is not option :))