Android: detect when app is installed

前端 未结 2 1138
孤城傲影
孤城傲影 2020-12-17 04:33

I am trying to download an Android app from a server using the DownloadManager class, install it and then detect when the installation is completed. I am using

2条回答
  •  旧巷少年郎
    2020-12-17 04:58

    I solved my problem, I added

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
    intentFilter.addAction(Intent.ACTION_PACKAGE_INSTALL);
    intentFilter.addDataScheme("package");
    

    before the line :

    registerReceiver(installReceiver, intentFilter);
    

提交回复
热议问题