My app relies heavily on a database for data and sometimes the database won't copy correctly, gets corrupted, or just throws a generic strop. Clearing the app data and then reopening the app seems to work well, but it's quite a chore to ask my users to dig through the settings pages, and I'm looking for a way to quickly get to the app details page (which shows the uninstall, move to SD, clear data etc.)
I've found the Settings.ACTION_APPLICATION_DETAILS_SETTINGS
Intent action but get an ActivityNotFoundException
when I try to launch it as described on my Desire Z. Can anyone help me out how to properly sort this?
Thanks
EDIT: As noted in the answers, this is only API9 and above, the code I now use if anyone wants it is below. Believe it works on API3 and above.
try {
Intent i = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
i.addCategory(Intent.CATEGORY_DEFAULT);
i.setData(Uri.parse("package:com.espian.formulae"));
startActivity(i);
} catch (ActivityNotFoundException ex) {
Intent i = new Intent(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS);
i.addCategory(Intent.CATEGORY_DEFAULT);
startActivity(i);
}
I know that this is way too late answer but it may help someone. Based on the platform (froyo) source I make one function that opens a specific package's settings page. It works in the emulator but I never tried on a real device. I don't know if it works on API < 8 either.
Here it is:
public boolean startFroyoInstalledAppDetailsActivity(String packagename) {
boolean result = false;
Intent i = new Intent();
i.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails");
i.setAction(Intent.ACTION_VIEW);
i.putExtra("pkg", packagename);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
cx.startActivity(i);
result = true;
} catch (Exception ex) {
result = false;
}
return result;
}
Based on your code I also make a Gingerbread version which works on real devices with API levels 9, 10, 11, 12, 13, 14 and 15 but it can be called safely from API 8 however in this case it will return false.
Here it is:
public boolean startGingerbreadInstalledAppDetailsActivity(String packagename) {
boolean result = false;
Intent i = new Intent();
i.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
i.addCategory(Intent.CATEGORY_DEFAULT);
i.setData(Uri.parse("package:" + packagename));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
cx.startActivity(i);
result = true;
} catch (Exception ex) {
result = false;
}
return result;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With