Install APK programmatically - return value
<p>In my app, I am calling a javascript interface from my activity. In the webview associated with this interface, I am asking the user to download and install an APK. I am using a "startActivityForResult" to start the install process (after downloading the file). Here is the code:</p>

<pre><code>Intent promptInstall = new Intent(Intent.ACTION_VIEW);
        promptInstall.setDataAndType(Uri.fromFile(new File(PATH + "app.apk")), "application/vnd.android.package-archive");
        startActivityForResult(promptInstall, ACCEPT_INSTALL);
</code></pre>

<p>I am using "onActivityResult" in the main activity class to capture the return value from the above activity. Here is the code:</p>

<pre><code>@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Log.d("requestCode, resultCode from Install APK: ", Integer.toString(requestCode) + ", " + Integer.toString(resultCode));   
}
</code></pre>

<p>The problem I am facing is that "resultCode" always returns 0, irrespective of whether the user chose to install the app or not install the app. I really need to know whether the user installed the app or not. Any ideas as to why the return value is always 0?</p>

<p>My last resort would be to use packagemanager to check for the existence of the app in the onActivityResult function to determine if the app was installed or not, but I would like to know why the return value is always 0.</p>

<p>Thanks much...</p>
