Hi Guys,
I am trying to install a 3rd party free app through code. I initially
download the apk from the web-site (androidfreeware.org), store it on
a SD Card. I am using an emulator to check whether my app is working
properly or not. I have attached a SD card to the currently running
avd.
Then when the user clicks on the Install, I use this code to
install it on the SD card.
public void onClick(View arg0) {
// TODO Auto-generated method stub
boolean success;
int result = Settings.Secure.getInt(getContentResolver(),
Settings.Secure.INSTALL_NON_MARKET_APPS, 0);
if (result == 0)
success =
Settings.Secure.putString(getContentResolver(),
Settings.Secure.INSTALL_NON_MARKET_APPS, "1");
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(downloadFile),
"application/vnd.android.package-archive");
startActivity(intent);
}
I read somewhere that in order to install 3rd party apps we need to
set the value of INSTALL_NON_MARKET_APPS to 1. Do we need to set any
permission in the manifest file. Also, when I checked logcat I got the
following error
Could not read the AndroidManifest.xml file of /sdcard/test.apk
and then it threw a FileNotFound Exception
What could be the problem ??
Thanks,
--
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