How to refresh Android gallery.

Hello there,

Having bit of a problem here, I using the Application.CaptureScreenshot to capture screenshot on my app, I manage to do it, Below is my code:

public var hit : RaycastHit;
public var GuiCam : Camera;

function Update () 
{
	var ray = GuiCam.ScreenPointToRay (Input.mousePosition);		
		
	if (Input.GetMouseButtonDown (0))  //Returns true during the frame the user touches the object
	{
		if (Physics.Raycast (ray, hit, 100)) 
		{	
			if (hit.collider.tag == "camera") 
			{
				Application.CaptureScreenshot ("screenshot.jpg");
			}
		}
	}
}

Now the problem is, when I closed my app and go to Android gallery I cannot see the screenshot that had been taken earlier. I have to turn off and on my Android device to see all the picture that had been taken, it’s like the gallery doesn’t refresh automatically. How do I solved this problem.

I try look on the web and found this System.IO.Directory.GetFiles (); but not sure how to use it, is this the solution or there is other?

Bump, anyone?

This has an answer, but I myself couldn’t make it work yet: Android: How to refresh the gallery ? - Questions & Answers - Unity Discussions

I know it’s probably the right solution because of this: Image, saved to sdcard, doesn't appear in Android's Gallery app - Stack Overflow

Seems like there’s no easy way to do it.

Any other simply solution? it is absurd!

I try GetDirectory but it doesn’t work!

It seems like nobody has succeeded in refreshing the gallery except with plugin usage. This is quite frustrating. I think Unity should add this Android gallery refreshing feature for the developers. I saw many frustrated developers with the same concern. I am facing the same trouble also and can’t find the solution until now.

1 Like

Anyone found a simple solution yet?