how i can start application info screen in android?
as per this link
In Android 2.3, you can use startActivity() on an ACTION_APPLICATION_DETAILS_SETTINGS Intent, with a proper Uri, to bring up your app's "manage" screen
or
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);
}
Invoke Android application info screen
From api level 9 and above you should be able to achieve what you want with the following:
Intent i = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
i.setData(Uri.parse("package:" + packageName));
startActivity(i);
Where packageName is for example: com.example.myapp
Opening Android Settings programmatically
I used the code from the most upvoted answer:
startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0);
It opens the device settings in the same window, thus got the users of my android application (finnmglas/Launcher) for android stuck in there.
The answer for 2020 and beyond (in Kotlin):
startActivity(Intent(Settings.ACTION_SETTINGS))
It works in my app, should also be working in yours without any unwanted consequences.
How to open application android programmatically if i don't know package name
Maybe something like this would help, but I have to add that this is a terrible approach as app names can be the same for different apps, and some apps (like "Contacts") have different labels based on the language set
/**
*
* @param appName The target app to launch, if there are multiple apps with same name, the first found will be launched
* @throws IllegalArgumentException If the target app was not found
*/
public void runApp(String appName) throws IllegalArgumentException {
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
for ( ResolveInfo info : getPackageManager().queryIntentActivities( mainIntent, 0) ) {
if ( info.loadLabel(getPackageManager()).equals(appName) ) {
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(info.activityInfo.applicationInfo.packageName);
startActivity(launchIntent);
return;
}
}
throw new IllegalArgumentException("Application not found!");
}
Related Topics
Proguard: Can't Find Referenced Class Com.Google.Android.Gms.R
Android O - Old Start Foreground Service Still Working
Android Runonuithread Explanation
Launch Skype from an App Programmatically & Pass Number - Android
Android Studio Gradle Dsl Method Not Found: 'Android()' -- Error(17,0)
Findfragmentbyid for Supportmapfragment Returns Null in Android Studio
Differencebetween Activity and Context
How to Change Textcolor in Alertdialog
Change Color of the Overflow Button on Actionbar
Volley JSONobjectrequest Post Parameters No Longer Work
How to Sign an APK with More Than One Certificate
Android:Get View Reference to a Menu Item
Android Pending Intent Notification Problem
How to Use Mapview in Android Using Google Map V2
Get Certificate Fingerprint from Android App
How to Add Shortcut to Home Screen in Android Programmatically
Android Device Chooser - My Device Seems Offline
A Failure Occurred While Executing Com.Android.Build.Gradle.Internal.Tasks