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:
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);
I am using "onActivityResult" in the main activity class to capture
the return value from the above activity. Here is the 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));
}
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?
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.
Thanks much...
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en