I am trying to open my app in
settings-> applications-> user apps-> MyApp1
i am using this snippet, it works fine, however, it fails at handling exceptions. Like when app isn't installed, in that case it should show a toast instead of shutting the whole app!
public void vpndragonsettings(View view) {
packageName = "org.wagtailvpn.android";
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) {
Toast toast = Toast.makeText(this, "app isn't installed!",
Toast.LENGTH_SHORT);
toast.show();
}
}