當前位置: 首頁>>代碼示例>>Java>>正文


Java Intent.ACTION_UNINSTALL_PACKAGE屬性代碼示例

本文整理匯總了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);
}
 
開發者ID:quaap,項目名稱:LaunchTime,代碼行數:9,代碼來源:MainActivity.java

示例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);
	}
}
 
開發者ID:Edc-zhang,項目名稱:cordova-plugin-file-opener2-android7.0,代碼行數:14,代碼來源:FileOpener2.java

示例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;
}
 
開發者ID:philipphager,項目名稱:disclosure-android-app,代碼行數:8,代碼來源:IntentFactory.java

示例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;
        }
    }

}
 
開發者ID:HitRoxxx,項目名稱:FloatingNew,代碼行數:28,代碼來源:SelectedApplication.java


注:本文中的android.content.Intent.ACTION_UNINSTALL_PACKAGE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。