title: Android - Wait for external storage to ready
body: <p>I'm currently developing a live wallpaper that reads from external storage.
  When the device is booting up, I assume it's possible for the live wallpaper to be launched before the storage is ready. Especially if its doing the periodic error check. Others are reporting issues and I think this is the reason. I can't seem to test this, because the external storage seems to mount instantly on my device, and I'm not sure how to force it to do the error check. So my first question is, does the system actually way for the BOOT_COMPLETED intent before it launches the live wallpaper. </p>
  
  <p>If not, what is the proper way to wait for the external storage to be ready. I'm thinking of calling something like this in the beginning of the app</p>
  
  <pre><code>public void waitForExternalStorage()
  {
      while(Environment.getExternalStorageState().equals(Environment.MEDIA_CHECKING))
      {
          try { Thread.sleep(1000L); }
          catch(InterruptedException e) { e.printStackTrace(); }
      }
  }
  </code></pre>
  
  <p>Do I have to check for other cases, in case it goes MEDIA_REMOVED -> MEDIA_UNMOUNTED -> MEDIA_CHECKING(optional) -> MEDIA_READY on boot?</p>