简体   繁体   中英

Update the Android Gallery after take a screenshot from AR camera?

We are developing an android app for taking screen shot from ARCamera in Unity.

The problem is that we are having a button,when we click on the button the photo gets saved in the folder that we have created in the phone, but the photo is not getting updated in the gallery folder of the phone.But when I delete any photo from that folder where the photo is being saved, then the images is shown in the gallery folder of the phone.

Refresh code

     AndroidJavaClass classPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");

     Debug.Log ("ffffff");

    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://" + AR_snap.folderpath)});        
    objActivity.Call ("sendBroadcast", objIntent);

But this worked on Samsung mobile phone (model no GT-I9300I) with Android 4.3. What could the issue be?

Try to add file to the gallery by calling

MediaStore.Images.Media.insertImage(getContentResolver(), pathToImage, yourTitle , yourDescription);

android - save image into gallery

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM