List of usage examples for android.content Intent ACTION_UNINSTALL_PACKAGE
String ACTION_UNINSTALL_PACKAGE
To view the source code for android.content Intent ACTION_UNINSTALL_PACKAGE.
Click Source Link
From source file:com.achep.acdisplay.receiver.LocalReceiverActivity.java
private void handleIntent(Intent intent) { String host = extractHost(intent); if (host == null) { Log.wtf(TAG, "Got an empty launch intent."); return;/*from w w w . j ava 2 s .c om*/ } switch (host) { case HOST_LAUNCH_DEVICE_ADMINS: Intent launchIntent = new Intent().setComponent( new ComponentName("com.android.settings", "com.android.settings.DeviceAdminSettings")); if (IntentUtils.hasActivityForThat(this, launchIntent)) { startActivity(launchIntent); } else { ToastUtils.showShort(this, getString(R.string.device_admin_could_not_be_started)); } break; case HOST_UNINSTALL: Uri packageUri = Uri.parse("package:" + PackageUtils.getName(this)); launchIntent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri); if (IntentUtils.hasActivityForThat(this, launchIntent)) { startActivity(launchIntent); } else { ToastUtils.showShort(this, getString(R.string.package_could_not_be_uninstalled)); } break; default: Log.wtf(TAG, "Got an unknown intent: " + host); return; } Intent broadcastIntent = new Intent(); broadcastIntent.setAction(host); LocalBroadcastManager.getInstance(this).sendBroadcast(broadcastIntent); }
From source file:com.achep.activedisplay.receiver.LocalReceiverActivity.java
private void handleIntent(Intent intent) { String host = extractHost(intent); if (host == null) { Log.wtf(TAG, "Got an empty launch intent."); return;/*from w w w . java 2s. c o m*/ } switch (host) { case HOST_LAUNCH_DEVICE_ADMINS: Intent launchIntent = new Intent().setComponent( new ComponentName("com.android.settings", "com.android.settings.DeviceAdminSettings")); if (IntentUtils.hasActivityForThat(this, launchIntent)) { startActivity(launchIntent); } else { ToastUtils.showShort(this, getString(R.string.device_admin_could_not_be_started)); } break; case HOST_UNINSTALL: Uri packageUri = Uri.parse("package:" + Project.getPackageName(this)); launchIntent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri); if (IntentUtils.hasActivityForThat(this, launchIntent)) { startActivity(launchIntent); } else { ToastUtils.showShort(this, getString(R.string.package_could_not_be_uninstalled)); } break; default: Log.wtf(TAG, "Got an unknown intent: " + host); return; } Intent broadcastIntent = new Intent(); broadcastIntent.setAction(host); LocalBroadcastManager.getInstance(this).sendBroadcast(broadcastIntent); }
From source file:org.mariotaku.twidere.fragment.ExtensionsListFragment.java
@Override public boolean onMenuItemClick(final MenuItem item) { if (mSelectedExtension == null) return false; switch (item.getItemId()) { case MENU_SETTINGS: { openSettings(mSelectedExtension); break;/*w ww . j a v a 2 s .c o m*/ } case MENU_DELETE: { final Uri packageUri = Uri.parse("package:" + mSelectedExtension.pname); final Intent uninstallIntent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri); startActivity(uninstallIntent); break; } case MENU_REVOKE: { mPermissionsManager.revoke(mSelectedExtension.pname); mAdapter.notifyDataSetChanged(); break; } } return false; }
From source file:org.fdroid.fdroid.installer.DefaultInstallerActivity.java
private void uninstallPackage(String packageName) { // check that the package is installed try {//w w w.j ava 2 s .c o m getPackageManager().getPackageInfo(packageName, 0); } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "NameNotFoundException", e); installer.sendBroadcastUninstall(packageName, Installer.ACTION_UNINSTALL_INTERRUPTED, "Package that is scheduled for uninstall is not installed!"); finish(); return; } Uri uri = Uri.fromParts("package", packageName, null); Intent intent = new Intent(); intent.setData(uri); if (Build.VERSION.SDK_INT < 14) { intent.setAction(Intent.ACTION_DELETE); } else { intent.setAction(Intent.ACTION_UNINSTALL_PACKAGE); intent.putExtra(Intent.EXTRA_RETURN_RESULT, true); } try { startActivityForResult(intent, REQUEST_CODE_UNINSTALL); } catch (ActivityNotFoundException e) { Log.e(TAG, "ActivityNotFoundException", e); installer.sendBroadcastUninstall(packageName, Installer.ACTION_UNINSTALL_INTERRUPTED, "This Android rom does not support ACTION_UNINSTALL_PACKAGE!"); finish(); } }
From source file:io.github.pwlin.cordova.plugins.fileopener2.FileOpener2.java
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();/*from www .j a va 2 s. co m*/ } else { JSONObject errorObj = new JSONObject(); errorObj.put("status", PluginResult.Status.ERROR.ordinal()); errorObj.put("message", "This package is not installed"); callbackContext.error(errorObj); } }
From source file:com.android.projectz.teamrocket.thebusapp.activities.SplashScreenActivity.java
public void showErrorDialog(String content, final String command) { if (command.equals("exit")) { new MaterialDialog.Builder(SplashScreenActivity.this).title(R.string.error_title).content(content) .cancelable(false).positiveText(R.string.dialog_ok_button) .onPositive(new MaterialDialog.SingleButtonCallback() { @Override/*from w ww . ja v a 2 s.c om*/ public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { finish(); startActivity(new Intent(Intent.ACTION_UNINSTALL_PACKAGE, Uri.parse("package:com.android.teamrocket.thebusproject.thebusapp"))); System.exit(0); } }).show(); } else { new MaterialDialog.Builder(SplashScreenActivity.this).title(R.string.error_title).content(content) .cancelable(false).positiveText(R.string.dialog_ok_button) .onPositive(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { if (command.contains("credentials")) { onStart(); } else if (command.contains("checkAll")) { onStart(); } else if (command.contains("retry")) { onStart(); } } }).negativeText(R.string.dialog_exit_button) .onNegative(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { System.exit(0); } }).show(); } }
From source file:com.mrchandler.disableprox.ui.SensorSettingsActivity.java
@Override protected void onResume() { super.onResume(); if (!isPackageInstalled(XPOSED_PACKAGE, this) && !prefs.getBoolean(Constants.PREFS_KEY_NEVER_SHOW_XPOSED_INSTALLED, false)) { final View view = LayoutInflater.from(this).inflate(R.layout.alert_dialog_xposed_not_installed_layout, null, false);//from w w w .ja v a 2 s . co m new AlertDialog.Builder(this).setTitle("Xposed Not Installed").setView(view) .setMessage(R.string.xposed_not_installed).setCancelable(false) .setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { CheckBox box = (CheckBox) view.findViewById(R.id.never_show_again_checkbox); prefs.edit() .putBoolean(Constants.PREFS_KEY_NEVER_SHOW_XPOSED_INSTALLED, box.isChecked()) .apply(); } }).setNegativeButton("Uninstall", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Uri packageUri = Uri.parse("package:" + Constants.PACKAGE_NAME); startActivity(new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri)); finish(); } }).show(); } }
From source file:com.launcher.silverfish.launcher.appdrawer.TabbedAppDrawerFragment.java
private void launchUninstallIntent(String package_name) { Uri packageUri = Uri.parse("package:" + package_name); Intent uninstallIntent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri); startActivity(uninstallIntent);//from w w w.j a va 2s . co m }
From source file:org.anurag.file.quest.TaskerActivity.java
/** * THIS FUNCTION REGISTERS THE RECEIVER FOR CUSTOM ACTION USED IN THE APP... */// www .ja v a 2 s. co m private void REGISTER_RECEIVER() { // TODO Auto-generated method stub RECEIVER = new BroadcastReceiver() { @Override public void onReceive(Context arg0, Intent it) { // TODO Auto-generated method stub String ACTION = it.getAction(); if (ACTION.equalsIgnoreCase("FQ_BACKUP") || ACTION.equals(Intent.ACTION_UNINSTALL_PACKAGE)) refreshList(CURRENT_ITEM); else if (ACTION.equalsIgnoreCase("FQ_DELETE")) { //setAdapter(CURRENT_ITEM); refreshList(CURRENT_ITEM); } else if (ACTION.equalsIgnoreCase("FQ_FLASHZIP")) { //FLASHABLE ZIP DIALOG IS FIRED FROM HERE new ZipDialog(mContext, size.x * 7 / 9, "FlashableZips"); } else if (ACTION.equalsIgnoreCase("FQ_DROPBOX_STARTLINK")) { //LINK A USER.... Toast.makeText(mContext, "First link an account", Toast.LENGTH_SHORT).show(); NEW_OPTIONS(indicator); } } }; IntentFilter filter = new IntentFilter("FQ_BACKUP"); this.registerReceiver(RECEIVER, filter); filter = new IntentFilter("FQ_DELETE"); this.registerReceiver(RECEIVER, filter); filter = new IntentFilter("FQ_FLASHZIP"); this.registerReceiver(RECEIVER, filter); filter = new IntentFilter(Intent.ACTION_UNINSTALL_PACKAGE); this.registerReceiver(RECEIVER, filter); }