本文整理汇总了Java中android.content.Intent.ACTION_UNINSTALL_PACKAGE属性的典型用法代码示例。如果您正苦于以下问题:Java Intent.ACTION_UNINSTALL_PACKAGE属性的具体用法?Java Intent.ACTION_UNINSTALL_PACKAGE怎么用?Java Intent.ACTION_UNINSTALL_PACKAGE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.Intent
的用法示例。
在下文中一共展示了Intent.ACTION_UNINSTALL_PACKAGE属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: launchUninstallIntent
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);
}
示例2: _uninstall
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);
}
}
示例3: uninstallPackage
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;
}
示例4: onButtonClickListener
@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;
}
}
}