Java Code Examples for android.content.Intent.ACTION_DELETE

The following are Jave code examples for showing how to use ACTION_DELETE 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: GitHub   File: Kits.java   View Source Code Vote up 6 votes
/**
 * 卸载App
 *
 * @param context
 * @param packageName
 * @return
 */
public static boolean uninstallNormal(Context context, String packageName) {
    if (packageName == null || packageName.length() == 0) {
        return false;
    }

    Intent i = new Intent(Intent.ACTION_DELETE, Uri.parse(new StringBuilder().append("package:")
            .append(packageName).toString()));
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(i);
    return true;
}
 
Example 2
Project: treasure   File: PackageUtil.java   View Source Code Vote up 6 votes
/**
 * 调用系统卸载应用
 */
public static void uninstallApk(Context context, String packageName) {
    Intent intent = new Intent(Intent.ACTION_DELETE);
    Uri packageURI = Uri.parse("package:" + packageName);
    intent.setData(packageURI);
    context.startActivity(intent);
}
 
Example 3
Project: GitHub   File: ApkUtils.java   View Source Code Vote up 6 votes
/** 卸载一个app */
public static void uninstall(Context context, String packageName) {
    //通过程序的包名创建URI
    Uri packageURI = Uri.parse("package:" + packageName);
    //创建Intent意图
    Intent intent = new Intent(Intent.ACTION_DELETE, packageURI);
    //执行卸载程序
    context.startActivity(intent);
}
 
Example 4
Project: EasyAndroid   File: IntentTool.java   View Source Code Vote up 6 votes
/**
 * 获取卸载App的意图
 *
 * @param packageName 包名
 * @return intent
 */
public static Intent getUninstallAppIntent(String packageName)
{
    Intent intent = new Intent(Intent.ACTION_DELETE);
    intent.setData(Uri.parse("package:" + packageName));
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
 
Example 5
Project: stynico   File: apitils.java   View Source Code Vote up 6 votes
/**
 * 卸载应用
 *
 * @param context     上下文
 * @param packageName 包名
 * @param requestCode 请求码
 */
public static void uninstallApk(Activity context,
                                String packageName, int requestCode) {
    Uri packageURI = Uri.parse("package:" + packageName);
    Intent intent = new Intent(
            Intent.ACTION_DELETE,// 动作:删除
            packageURI // 所要删除程序的地址
    );
    context.startActivityForResult(intent, requestCode);
    //ForResult 等待返回值的发送(扔飞镖)
}
 
Example 6
Project: CorePatch   File: PackageUtils.java   View Source Code Vote up 6 votes
/**
 * uninstall package normal by system intent
 *
 * @param context
 * @param packageName package name of app
 * @return whether package name is empty
 */
public static boolean uninstallNormal(Context context, String packageName) {
    if (packageName == null || packageName.length() == 0) {
        return false;
    }

    Intent i = new Intent(Intent.ACTION_DELETE, Uri.parse(new StringBuilder(32).append("package:")
            .append(packageName).toString()));
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(i);
    return true;
}
 
Example 7
Project: simple-share-android   File: PackageManagerUtils.java   View Source Code Vote up 6 votes
public static void uninstallApp(Context context, String packageName) {
	try {
		Uri packageUri = Uri.fromParts("package", packageName, null);
		if(packageUri != null){
			Intent intentUninstall = new Intent(Intent.ACTION_DELETE, packageUri);
			intentUninstall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(intentUninstall);
		}
	} catch (Exception e) { }
}
 
Example 8
Project: KUtils   File: Utils.java   View Source Code Vote up 6 votes
/**
 * 卸载apk
 *
 * @param context     上下文
 * @param packageName 包名
 */
public static void uninstallApk(Context context, String packageName) {
    Intent intent = new Intent(Intent.ACTION_DELETE);
    Uri packageURI = Uri.parse("package:" + packageName);
    intent.setData(packageURI);
    context.startActivity(intent);
}
 
Example 9
Project: PicShow-zhaipin   File: DeviceUtils.java   View Source Code Vote up 6 votes
/**
 * 卸载软件
 *
 * @param context
 * @param packageName
 */
public static void uninstallApk(Context context, String packageName) {
    if (isPackageExist(context, packageName)) {
        Uri packageURI = Uri.parse("package:" + packageName);
        Intent uninstallIntent = new Intent(Intent.ACTION_DELETE,
                packageURI);
        context.startActivity(uninstallIntent);
    }
}
 
Example 10
Project: amap   File: MIP_SystemUtils.java   View Source Code Vote up 6 votes
/**
 * 卸载apk
 * 
 * @param context
 * @param packname
 */
public static void uninstallApk(Context context, String packname)
{
    Uri packageURI = Uri.parse("package:" + packname);
    
    Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
    
    context.startActivity(uninstallIntent);
}
 
Example 11
Project: XinFramework   File: PackageUtil.java   View Source Code Vote up 6 votes
/**
 * 调用系统卸载应用
 */
public static void uninstallApk(Context context, String packageName) {
    Intent intent = new Intent(Intent.ACTION_DELETE);
    Uri packageURI = Uri.parse("package:" + packageName);
    intent.setData(packageURI);
    context.startActivity(intent);
}
 
Example 12
Project: SmartChart   File: AppUtils.java   View Source Code Vote up 6 votes
/**
 * 卸载apk
 *
 * @param context     上下文
 * @param packageName 包名
 */
public static void uninstallApk(Context context, String packageName) {
    Intent intent = new Intent(Intent.ACTION_DELETE);
    Uri packageURI = Uri.parse("package:" + packageName);
    intent.setData(packageURI);
    context.startActivity(intent);
}
 
Example 13
Project: GongXianSheng   File: CommonUtils.java   View Source Code Vote up 5 votes
public static void uninstallApk(Context context, String packageName) {
	Uri uri = Uri.parse("package:" + packageName);
	Intent intent = new Intent(Intent.ACTION_DELETE, uri);
	context.startActivity(intent);
}
 
Example 14
Project: FCM-toolbox   File: AppPayload.java   View Source Code Vote up 5 votes
public Intent getRemoveIntent() {
    Intent intent = new Intent(Intent.ACTION_DELETE, Uri.parse("package:" + packageName));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return intent;
}
 
Example 15
Project: BaseCore   File: IntentUtils.java   View Source Code Vote up 3 votes
/**
 * 获取卸载App的意图
 *
 * @param packageName 包名
 * @return intent
 */
public static Intent getUninstallAppIntent(String packageName) {
    Intent intent = new Intent(Intent.ACTION_DELETE);
    intent.setData(Uri.parse("package:" + packageName));
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
 
Example 16
Project: codedemos   File: IntentUtil.java   View Source Code Vote up 3 votes
/**
 * 获取卸载App的意图
 *
 * @param packageName 包名
 * @return intent
 */
public static Intent getUninstallAppIntent(String packageName) {
    Intent intent = new Intent(Intent.ACTION_DELETE);
    intent.setData(Uri.parse("package:" + packageName));
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
 
Example 17
Project: RLibrary   File: IntentUtils.java   View Source Code Vote up 3 votes
/**
 * 获取卸载App的意图
 *
 * @param packageName 包名
 * @return intent
 */
public static Intent getUninstallAppIntent(String packageName) {
    Intent intent = new Intent(Intent.ACTION_DELETE);
    intent.setData(Uri.parse("package:" + packageName));
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
 
Example 18
Project: HeadlineNews   File: IntentUtils.java   View Source Code Vote up 3 votes
/**
 * 获取卸载App的意图
 *
 * @param packageName 包名
 * @return intent
 */
public static Intent getUninstallAppIntent(final String packageName) {
    Intent intent = new Intent(Intent.ACTION_DELETE);
    intent.setData(Uri.parse("package:" + packageName));
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
 
Example 19
Project: GrowingProject   File: ApkUtils.java   View Source Code Vote up 3 votes
/**
 * 卸载应用程序
 *
 * @param pContext
 * @param packageName
 */
public static void uninstallApk(Context pContext, String packageName) {
    Uri packageURI = Uri.parse("package:" + packageName);
    Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
    pContext.startActivity(uninstallIntent);
}
 
Example 20
Project: Coder   File: IntentUtils.java   View Source Code Vote up 3 votes
/**
 * 获取卸载App的意图
 *
 * @param packageName 包名
 * @return intent
 */
public static Intent getUninstallAppIntent(String packageName) {
    Intent intent = new Intent(Intent.ACTION_DELETE);
    intent.setData(Uri.parse("package:" + packageName));
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}