Is android.intent.action.DOWNLOAD_COMPLETE an explicit broadcast?

吃可爱长大的小学妹 提交于 2019-12-05 07:35:56

Here's what I found after digging further into the platform's source code:

1) When we instantiate the DownloadManager, it keeps a reference to the context of the app and extracts the app's package name from that context

2) That package name is inserted into the downloads database into column Downloads.Impl.COLUMN_NOTIFICATION_PACKAGE when the download is requested

3) When the download completes, the DownloadInfo.sendIntentIfRequested() method will call Intent.setPackage() passing the package name. According to the description of method Intent.setPackage():

(Usually optional) Set an explicit application package name that limits the components this Intent will resolve to. If left to the default value of null, all components in all applications will considered. If non-null, the Intent can only match the components in the given application package.

Based on that description, my understanding is that the broadcast intent will be targeted at my app, thus working as an explicit intent.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!