Java Code Examples for android.content.Intent.ACTION_UNINSTALL_PACKAGE

The following are Jave code examples for showing how to use ACTION_UNINSTALL_PACKAGE of the android.content.Intent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: cordova-plugin-file-opener2-android7.0   File: FileOpener2.java   View Source Code Vote up 6 votes
private void _uninstall(String packageId, CallbackContext callbackContext) throws JSONException {
	if (this._appIsInstalled(packageId)) {
		Intent intent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE);
		intent.setData(Uri.parse("package:" + packageId));
		cordova.getActivity().startActivity(intent);
		callbackContext.success();
	}
	else {
		JSONObject errorObj = new JSONObject();
		errorObj.put("status", PluginResult.Status.ERROR.ordinal());
		errorObj.put("message", "This package is not installed");
		callbackContext.error(errorObj);
	}
}
 
Example 2
Project: disclosure-android-app   File: IntentFactory.java   View Source Code Vote up 6 votes
public Intent uninstallPackage(final String packageName) {
  Uri packageUri = Uri.parse(String.format("package:%s", packageName));

  Intent intent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE);
  intent.setData(packageUri);
  intent.putExtra(Intent.EXTRA_RETURN_RESULT, true);
  return intent;
}
 
Example 3
Project: LaunchTime   File: MainActivity.java   View Source Code Vote up 6 votes
private void launchUninstallIntent(String packageName) {
    if (mChildLock) return;

    Log.d(TAG, "Uninstalling " + packageName);
    Uri packageUri = Uri.parse("package:" + packageName);
    Intent uninstallIntent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri);
    uninstallIntent.putExtra(Intent.EXTRA_RETURN_RESULT, true);
    startActivityForResult(uninstallIntent, UNINSTALL_RESULT);
}
 
Example 4
Project: FloatingNew   File: SelectedApplication.java   View Source Code Vote up 6 votes
@Override
public void onButtonClickListener(AppInfo app, View v) {

    int id = v.getId();
    switch (id) {
        case R.id.uninstallApk: {
            Toast.makeText(this, "uninstall", Toast.LENGTH_SHORT).show();
            Intent intent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE);
            intent.setData(Uri.parse("package:" + app.getPacName()));
            intent.putExtra(Intent.EXTRA_RETURN_RESULT, true);
            startActivityForResult(intent, UNINSTALL_REQUEST_CODE);
            break;
        }
        case R.id.extractApk: {
            Toast.makeText(this, "extract", Toast.LENGTH_SHORT).show();
            new ExtractFileInBackground(SelectedApplication.this, app).execute();
            break;
        }
        case R.id.shareApk: {
            Toast.makeText(this, "share", Toast.LENGTH_SHORT).show();
            UtilsApp.copyFile(app);
            Intent shareIntent = UtilsApp.getShareIntent(UtilsApp.getOutputFilename(app));
            startActivity(Intent.createChooser(shareIntent, String.format(getResources().getString(R.string.send_to), app.getAppName())));
            break;
        }
    }

}