Search Unity

How to refresh Android gallery.

Discussion in 'Android' started by hizral, Dec 7, 2012.

  1. hizral

    hizral

    Joined:
    Apr 27, 2010
    Posts:
    568
    Hello there,

    Having bit of a problem here, I using the
    Code (csharp):
    1. Application.CaptureScreenshot
    to capture screenshot on my app, I manage to do it, Below is my code:
    Code (csharp):
    1.  
    2. public var hit : RaycastHit;
    3. public var GuiCam : Camera;
    4.  
    5. function Update ()
    6. {
    7.     var ray = GuiCam.ScreenPointToRay (Input.mousePosition);       
    8.        
    9.     if (Input.GetMouseButtonDown (0))  //Returns true during the frame the user touches the object
    10.     {
    11.         if (Physics.Raycast (ray, hit, 100))
    12.         {  
    13.             if (hit.collider.tag == "camera")
    14.             {
    15.                 Application.CaptureScreenshot ("screenshot.jpg");
    16.             }
    17.         }
    18.     }
    19. }
    20.  
    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
    Code (csharp):
    1. System.IO.Directory.GetFiles ();
    but not sure how to use it, is this the solution or there is other?
     
    Last edited: Dec 7, 2012
  2. hizral

    hizral

    Joined:
    Apr 27, 2010
    Posts:
    568
    Bump, anyone?
     
  3. Cawas

    Cawas

    Joined:
    Jan 14, 2010
    Posts:
    121
  4. kaz2057

    kaz2057

    Joined:
    Jan 18, 2011
    Posts:
    326
    Last edited: Jan 9, 2013
  5. reinaldozhang

    reinaldozhang

    Joined:
    Jun 9, 2015
    Posts:
    8
    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.
     
    artofmining likes this.
  6. artofmining

    artofmining

    Joined:
    May 1, 2016
    Posts:
    31
    Anyone found a simple solution yet?
     
unityunity