Can't receive broadcasts for PACKAGE intents

后端 未结 3 1998
伪装坚强ぢ
伪装坚强ぢ 2020-12-17 02:22

I am trying to register a Broadcast Receiver to receive broadcast events for the package events. Following is the code and my receiver in the manifest file. The log statment

3条回答
  •  臣服心动
    2020-12-17 03:07

    These three intents namely,

    Intent.ACTION_PACKAGE_ADDED
    Intent.ACTION_PACKAGE_REMOVED
    Intent.ACTION_PACKAGE_CHANGED
    

    when broadcasted by the system, have

    Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT
    

    flag added so that only the registered receivers will receive the broadcasts and no broadcast receiver components will be launched. Refer Intent and PackageManagerService class of source for further details.

提交回复
热议问题