Failed to install apk file by Package Installer in Android?
<p>all,
I have some problem installing my apk file in code. Wondering if anyone could find out what I did wrong.
What I was trying to do is put a Check Upgrade function in our program. When user clicks it, it will send request to our web server and find out what is the latest version. I use app versionName to stamp a version, something like 2010.11.23. I don't use the version code in Manifest.xml file. So our program sees the latest VersionName is later than itself, it will download the latest one, and then use the following code to install the new apk file:</p>

<pre><code>Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(strNewAPKFile),"application/vnd.android.package-archive");
this.startActivity(intent);
</code></pre>

<p>Now looks like, everytime when I changed the VersionName, it will fail to install the apk file. It downloads the file fine. I don't know exactly why. Sometimes, in Eclips, when I hit debug, I got error saying "Re-installation failed due to different application signatures". I don't know if this is the same error caused the installation failed.</p>

<p>So, looks like my questions are:</p>

<ol>
<li>Should that upgrade logic work? I am wondering if it has something to do with the VersoinName.</li>
<li>What could cause the application signature change? (I did sign our program before I put it on our server, but I always use the same key file for different versionName. )</li>
</ol>

<p>Any input are welcome.</p>
