我怎样才能启动Android应用程序信息屏幕编程? [英] How can I start android application info screen programmatically?
问题描述
是否有可能启动应用程序信息屏幕(即菜单
→ 设置
→ 应用程序
→ 管理应用程序
→然后从另一个应用程序的任何应用程序)
Is it possible to start the "application info" screen (that is, Menu
→ Settings
→ Applications
→ Manage Applications
→ select any application) from another app?
推荐答案
在2.2及以下,没有公开的API可以访问。但是,你仍然可以启动 InstalledAppDetails 活动就像 ManageApplications 一样。看<一href="http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;a=blob;f=src/com/android/settings/ManageApplications.java;h=9cd6e23ce3a0fb2254fdaa2ebde3a7fc9324d4e6;hb=c0a606d2d639c34bb763b73974e04e55f2d2ad8d">here
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);
}
这篇关于我怎样才能启动Android应用程序信息屏幕编程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!