ACTION_MY_PACKAGE_REPLACED not received

后端 未结 9 688
长发绾君心
长发绾君心 2020-12-08 00:59

I am using ACTION_MY_PACKAGE_REPLACED to receive when my app is updated or resinstalled. My problem is that the event is never triggered (I tried Eclipse and real device). T

9条回答
  •  执笔经年
    2020-12-08 01:37

    Actually, your app will start twice when you install your apk. Once for each receiver that you have set.

    When you are Listening to android.intent.action.PACKAGE_REPLACED then you need to check for the package-name in the intent.getData()

    Note that intent.getData() will be Null when it is from android.intent.action.MY_PACKAGE_REPLACED

    I think using one of them is enough.

提交回复
热议问题