第一点,安装

String fileName = Environment.getExternalStorageDirectory() + "/myApp.apk";        
Intent intent = new Intent(Intent.ACTION_VIEW);     
intent.setDataAndType(Uri.parse("file://" + filePath),"application/vnd.android.package-archive");     
或者     
//intent.setDataAndType(Uri.fromFile(new File(fileName)), "application/vnd.android.package-archive");      
startActivity(intent); 

第二点,卸载:

Uri packageURI = Uri.parse("package:com.android.myapp");        
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);        
startActivity(uninstallIntent);

第三点,一个完整卸载老版本的软件的例子

if (checkOldVersion()) {
            showDialog(DIALOG_UPDATE);
        }

private boolean checkOldVersion() {
        // TODO Auto-generated method stub

        Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
        mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
        List<ResolveInfo> mAllApps = getPackageManager().queryIntentActivities(
                mainIntent, 0);
        for (ResolveInfo info : mAllApps) {
            if (info.activityInfo.packageName
                    .equalsIgnoreCase("com.anydata.apps.work")) {
                return true;

            }
        }

        return false;
    }

@Override
protected Dialog onCreateDialog(int id) {
    // TODO Auto-generated method stub
    switch (id) {
    case DIALOG_UPDATE:

        AlertDialog.Builder builder = new Builder(SplashScreen.this);
        builder.setMessage("现在要卸载旧版本吗?");
        builder.setTitle("发现旧版本");
        builder.setCancelable(false);
        builder.setPositiveButton("卸载",
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {

                        // 通过程序的包名创建URL
                        Uri packageURI = Uri
                                .parse("package:com.anydata.apps.work");
                        // 创建Intent意图
                        Intent intent = new Intent(Intent.ACTION_DELETE);
                        // 设置Uri
                        intent.setData(packageURI);
                        // 卸载程序
                        startActivity(intent);
                        dialog.dismiss();
                        finish();
                    }
                });
        // builder.setNegativeButton("取消",
        // new DialogInterface.OnClickListener() {
        // @Override
        // public void onClick(DialogInterface dialog, int which) {
        // dialog.dismiss();
        // splashTread.start();
        // }
        // });
        return builder.create();
    }
    return super.onCreateDialog(id);
}