Crash on android app uninstall via Intent

000000000000000000000

why does my app crash when I try to call this function?

public void uninstall(){
    Intent intent;
    String packageName;

    packageName = HelloWorldActivity.class.getPackage().getName();
    intent = new Intent(Intent.ACTION_DELETE);
    intent.setData(Uri.parse(packageName));
    startActivity(intent);      
}

Do I need any permissions to uninstall packages?
Do I need to add .toString() to .getName()?

endasan

The Uri scheme for packages needs to have "package" keyword before the actual package name, so try this: packageName = "package:"+HelloWorldActivity.class.getPackage().getName();

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related