简体   繁体   English

从设备上卸载应用

[英]Uninstall App from device

I want to remove app from device, as i perform uninstall , app must removed from the ArrayList and update the app drawer like wise. 我想从设备中删除应用程序,因为我执行卸载,所以必须从ArrayList中删除应用程序,并像明智地更新应用程序抽屉。

IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_PACKAGE_ADDED);
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
filter.addDataScheme("package");
registerReceiver(new RefreshApps(), filter);

}

public class RefreshApps extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
    // TODO Auto-generated method stub
    Toast.makeText(context, "App Installed/Removed" ,Toast.LENGTH_SHORT).show();

}

}

You can find out that an app is being removed via a BroadcastReceiver listening for ACTION_PACKAGE_REMOVED. 您可以发现某个应用正在通过BroadcastReceiver监听ACTION_PACKAGE_REMOVED删除。 You can find out one has been installed by listening for ACTION_PACKAGE_ADDED. 您可以通过听ACTION_PACKAGE_ADDED来发现已经安装了一个。 Obviously these work for anything except your own app. 显然,这些功能适用于您自己的应用以外的任何应用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM