Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I start android application info screen programmatically?

Tags:

android

Is it possible to start the "application info" screen (that is, MenuSettingsApplicationsManage Applications → select any application) from another app?

like image 319
kopi_b Avatar asked Dec 12 '10 12:12

kopi_b


People also ask

How do I open app info?

Go to Your data in the Assistant or Your data in Search. Under "Google-wide controls," tap App info from your devices.

How do I get to programmatically in Android settings?

Now you can use Intent intent = new Intent(android. provider. Settings. ACTION_SECURITY_SETTINGS); startActivity(intent); There are whole bunch of constants for every main settings category that you can choose from.


2 Answers

In 2.2 and below, there is no public APIs you can access. But you can still start the InstalledAppDetails activity just as the ManageApplications does. see here

 // utility method used to start sub activity  private void startApplicationDetailsActivity() {      // Create intent to start new activity      Intent intent = new Intent(Intent.ACTION_VIEW);      intent.setClass(this, InstalledAppDetails.class);      intent.putExtra(APP_PKG_NAME, mCurrentPkgName);      // start new activity to display extended information      startActivityForResult(intent, INSTALLED_APP_DETAILS);  } 

Conclusion: you can start the "application info" screen like this i wrote:

private static final String SCHEME = "package";  private static final String APP_PKG_NAME_21 = "com.android.settings.ApplicationPkgName";  private static final String APP_PKG_NAME_22 = "pkg";  private static final String APP_DETAILS_PACKAGE_NAME = "com.android.settings";  private static final String APP_DETAILS_CLASS_NAME = "com.android.settings.InstalledAppDetails";  public static void showInstalledAppDetails(Context context, String packageName) {     Intent intent = new Intent();     final int apiLevel = Build.VERSION.SDK_INT;     if (apiLevel >= 9) { // above 2.3         intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);         Uri uri = Uri.fromParts(SCHEME, packageName, null);         intent.setData(uri);     } else { // below 2.3         final String appPkgName = (apiLevel == 8 ? APP_PKG_NAME_22                 : APP_PKG_NAME_21);         intent.setAction(Intent.ACTION_VIEW);         intent.setClassName(APP_DETAILS_PACKAGE_NAME,                 APP_DETAILS_CLASS_NAME);         intent.putExtra(appPkgName, packageName);     }     context.startActivity(intent); } 
like image 143
ZhengZhiren Avatar answered Sep 23 '22 19:09

ZhengZhiren


From API Level 9 (Android 2.3) you can start an Intent with android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS. Thus:

packageName = "your.package.name.here"  try {     //Open the specific App Info page:     Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);     intent.setData(Uri.parse("package:" + packageName));     startActivity(intent);  } catch ( ActivityNotFoundException e ) {     //e.printStackTrace();      //Open the generic Apps page:     Intent intent = new Intent(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS);     startActivity(intent);  } 
like image 40
Paolo Rovelli Avatar answered Sep 19 '22 19:09

Paolo Rovelli