Broadcast receiver for PACKAGE_ADDED not working from Android 3.1 onwards

后端 未结 1 530
隐瞒了意图╮
隐瞒了意图╮ 2020-12-11 14:00

I am not able to launch my Broadcast receiver which is part of a STOPPED Application, I had registered for PACKAGE_ADDED event in the broadcast receiver, The application wor

相关标签:
1条回答
  • 2020-12-11 14:54

    The docs for PACKAGE_ADDED state:

    This is a protected intent that can only be sent by the system.

    You can't modify it, or try to add flags to it. From the release notes for 3.1:

    Note that the system adds FLAG_EXCLUDE_STOPPED_PACKAGES to all broadcast intents.

    and from the docs for FLAG_EXCLUDE_STOPPED_PACKAGES

    If set, this intent will not match any components in packages that are currently stopped. If this is not set, then the default behavior is to include such applications in the result.

    All this means that your app won't work the same way as it used to. You'll have to make sure your app is started in order to receive PACKAGE_ADDED.

    0 讨论(0)
提交回复
热议问题