卸载应用
if(app.isUser()){ Uri uri = Uri.parse("package:" + app.getPageName()); Intent deleteIntent = new Intent(); deleteIntent.setType(Intent.ACTION_DELETE); deleteIntent.addCategory("android.intent.category.DEFAULT"); deleteIntent.setData(uri); startActivityForResult(deleteIntent,0); }else{ Toast.makeText(AppManagerActivity.this, "不能卸载系统应用", 0).show(); isPopAlive(); }
启动应用
PackageManager pm = getPackageManager(); //通过包名启动 Intent intent = pm.getLaunchIntentForPackage(app.getPageName()); startActivity(intent);
分享应用
// TODO Auto-generated method stub Intent sendIntent = new Intent(); sendIntent.setAction("android.intent.action.SEND"); sendIntent.addCategory("android.intent.category.DEFAULT"); sendIntent.setType("text/plain"); //编辑内容 sendIntent.putExtra(Intent.EXTRA_TEXT,app.getName()); startActivity(sendIntent);
时间: 2024-10-12 04:42:44