title: Why Unity3D Application.CaptureScreenshot for Android doesn't work?
body: <p>I have tried all this links bellow:</p>
  
  <p><a href="https://stackoverflow.com/questions/17809173/not-getting-image-from-persistant-path-in-android-using-unity3d">Not getting image from Persistant path in Android using unity3d</a></p>
  
  <p><a href="https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/capture-screen-problem-androidhelp" rel="nofollow noreferrer">https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/capture-screen-problem-androidhelp</a></p>
  
  <p><a href="http://answers.unity3d.com/questions/731509/applicationcapturescreenshot-doesnt-save-anything.html" rel="nofollow noreferrer">http://answers.unity3d.com/questions/731509/applicationcapturescreenshot-doesnt-save-anything.html</a></p>
  
  <p><a href="https://stackoverflow.com/questions/11725548/i-need-to-set-the-path-for-saving-the-pictures-with-an-application-for-android-a">I need to set the path for saving the pictures with an application for Android and IOS with UNITY</a></p>
  
  <p><a href="http://answers.unity3d.com/questions/200173/android-how-to-refresh-the-gallery-.html#answer-893069" rel="nofollow noreferrer">http://answers.unity3d.com/questions/200173/android-how-to-refresh-the-gallery-.html#answer-893069</a></p>
  
  <p>Every time i build an apk, install it on Android device, nothing happend. 
  Log doesn't exists, so i tryed all this links and then go to /DCIM/Camera/ to see if is it saved, no, nothing...</p>
  
  <p>On iOS i did that, and work perfectly.</p>
  
  <p>Here is some code where i stuck... or the things on Android wont work...
  I don't know why no error appear or some file strange in folder</p>
  
  <pre><code>    void saveImage()
      {
      #if UNITY_ANDROID
      string theFileName = "Screenshot_" + System.DateTime.Now.ToString("MM_dd_yyyy") +"_"+ System.DateTime.Now.ToString("hh_mm_ss")  +".png";
  
          // Many different test, trying to discovery witch will work...
          Application.CaptureScreenshot( Application.dataPath + "_" + theFileName );
          Application.CaptureScreenshot( "../../../../DCIM/Camera/pathroot_" + theFileName );
          Application.CaptureScreenshot( "/storage/emulated/0/DCIM/Camera/" + theFileName );
          Application.CaptureScreenshot( "file:///storage/emulated/0/DCIM/Camera/" + theFileName );
  
          StartCoroutine(TakeScreenshot()); // Different test
  
      #endif
      #if  UNITY_IPHONE
          // This work... so, does not need to be here...
      #endif
      }
  </code></pre>
  
  <p>This is the method that "Coroutine" calls ( copy from one of those links above ):</p>
  
  <pre><code>private IEnumerator TakeScreenshot()
  {
      yield return new WaitForEndOfFrame();
  
      //INITIAL SETUP
      string myFilename = "Screenshot_" + System.DateTime.Now.ToString("MM_dd_yyyy") +"_"+ System.DateTime.Now.ToString("hh_mm_ss")  +".png";
      string myDefaultLocation = Application.dataPath + "/" + myFilename;
  
      //EXAMPLE OF DIRECTLY ACCESSING THE Camera FOLDER OF THE GALLERY
      //string myFolderLocation = "/storage/emulated/0/DCIM/Camera/";
      //EXAMPLE OF BACKING INTO THE Camera FOLDER OF THE GALLERY
      //string myFolderLocation = Application.persistentDataPath + "/../../../../DCIM/Camera/";
      //EXAMPLE OF DIRECTLY ACCESSING A CUSTOM FOLDER OF THE GALLERY
      string myFolderLocation = "/storage/emulated/0/DCIM/Camera/";
      string myScreenshotLocation = myFolderLocation + myFilename;
  
      //ENSURE THAT FOLDER LOCATION EXISTS
      if(!System.IO.Directory.Exists(myFolderLocation)){
          System.IO.Directory.CreateDirectory(myFolderLocation);
      }
  
      //TAKE THE SCREENSHOT AND AUTOMATICALLY SAVE IT TO THE DEFAULT LOCATION.
      Application.CaptureScreenshot(myFilename);
  
      //MOVE THE SCREENSHOT WHERE WE WANT IT TO BE STORED
      System.IO.File.Move(myDefaultLocation, myScreenshotLocation);
  
      //REFRESHING THE ANDROID PHONE PHOTO GALLERY IS BEGUN
      AndroidJavaClass classPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
      AndroidJavaObject objActivity = classPlayer.GetStatic&lt;AndroidJavaObject&gt;("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&lt;AndroidJavaObject&gt;("parse", "file://" + myScreenshotLocation)});        
      objActivity.Call ("sendBroadcast", objIntent);
      //REFRESHING THE ANDROID PHONE PHOTO GALLERY IS COMPLETE
  
      //AUTO LAUNCH/VIEW THE SCREENSHOT IN THE PHOTO GALLERY
      Application.OpenURL(myScreenshotLocation);
  
      //AFTERWARDS IF YOU MANUALLY GO TO YOUR PHOTO GALLERY, 
      //YOU WILL SEE THE FOLDER WE CREATED CALLED "myFolder"
  }
  </code></pre>