title: Downloading and installing an APK using volley
body: <p>I'm tring to download an update over the web. This is with the latest volley version. I'm using a <code>Stringrequest</code> at the moment.</p>
  
  <pre><code>class UpdateService : IntentService("Update Serivce") {
  companion object {
      val VERSION_URL = "&lt;version url&gt;"
      val FILE_URL = "&lt;apk url&gt;"
      val LOG_TAG = "UPDATE"
      fun initialize(context: Context) = context.startService(Intent(context, UpdateService::class.java))
  }
  
  /**
   * Checks remote for an update
   */
  override fun onHandleIntent(intent: Intent?) {
      Log.d(LOG_TAG, "Retrieving new version")
      // Get version number
      NetworkService().get(Uri.parse(VERSION_URL),
              Response.Listener { success(it) },
              Response.ErrorListener {
                  Log.d(LOG_TAG, "Failed to update ${it.toString()}")
                  FirebaseCrash.report(it)
              })
  }
  
  private fun success(it: String?) {
      Log.d(LOG_TAG, "Remote version: $it")
      Log.d(LOG_TAG, "Local version: ${BuildConfig.VERSION_NAME}")
  
      if (!it.equals(BuildConfig.VERSION_NAME)) {
          Log.d(LOG_TAG, "Fetching new update")
          NetworkService().get(
                  Uri.parse(FILE_URL),
                  Response.Listener { installUpdate(it) },
                  Response.ErrorListener {
                      Log.d(LOG_TAG, "failed to get new APK")
                      FirebaseCrash.report(it)
                  }
          )
      }
  }
  
  private fun installUpdate(it: String) {
      Log.d(LOG_TAG, "retrieved update")
  
      val file = File(this.externalCacheDir, "update.apk")
  
      if(!file.exists()){
          file.createNewFile()
      }
  
      file.writeBytes(it.toByteArray())
  
      val intent = Intent(Intent.ACTION_VIEW)
      intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive")
      intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
  
      Log.d(LOG_TAG, "Installing")
  
      startActivity(intent)
  }
  </code></pre>
  
  <p>}</p>
  
  <p>When launching the installing activity, I will get a parse error from android. </p>
  
  <p><a href="https://i.stack.imgur.com/4D13f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4D13f.png" alt="can&#39;t parse"></a></p>
  
  <p>How can I download and save the file as an usable APK with volley?</p>