title: .apk file not installed programmatically
body: <p>I want to .apk file which is new version on my app. install on Android device for upgrade;</p>
  
  <p>But I get "Parse Error" or "App not installed"</p>
  
  <p><em>If I manually try install .apk file DELETE old version app. , it works</em>
  <em>If I manually try install .apk file after debug old version app it does not work</em></p>
  
  <p>I tested on another different .apk file on my code it can be install so I do not think about that but here is it you can check;</p>
  
  <pre><code> File fileTest = new File(Environment.getExternalStorageDirectory() + "/download/appName.apk");
      if (fileTest != null &amp;&amp; fileTest.exists() == true){
          Intent intent = new Intent(Intent.ACTION_VIEW);
          intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true);
          intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
          intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
          intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/appName.apk")), "application/vnd.android.package-archive");
          startActivity(intent);
  </code></pre>
  
  <p>This problem may be <strong>Signature differ</strong> or <strong>Sdk versions differ</strong>.
  I tested signature differ with my code app and .apk file here it is;</p>
  
  <pre><code> Signature sig = updateContext.getPackageManager().
             getPackageInfo(updateManager.updateContext.getPackageName(), 
              PackageManager.GET_SIGNATURES).signatures[0];
  
  Signature releaseSig = updateManager.updateContext.getPackageManager().
    getPackageArchiveInfo(path2, PackageManager.GET_SIGNATURES).signatures[0];
  
  String path2 =Environment.getExternalStorageDirectory() + 
              "/download/appName.apk";
  
  if (sig.hashCode() != releaseSig.hashCode()) //false
  </code></pre>
  
  <p>So what do you think about this?</p>