Are you want to uninstall app from you code, here is the snap code.
package com.example.packageName;
public class UninstallApp extends Activity {
private Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn=(Button) findViewById(R.id.btn_next);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_DELETE);
or
///Intent intent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE);
intent.setData(Uri.parse("package:com.example.packageName"));
startActivity(intent);
}
});
Here is the snapshots of this app:
Click Ok for uninstall app and Cancel for cancel dialog box.
Happy Coding!!!
package com.example.packageName;
public class UninstallApp extends Activity {
private Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn=(Button) findViewById(R.id.btn_next);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_DELETE);
or
///Intent intent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE);
intent.setData(Uri.parse("package:com.example.packageName"));
startActivity(intent);
}
});
Here is the snapshots of this app:
Click Ok for uninstall app and Cancel for cancel dialog box.
Happy Coding!!!