Sticky Broadcasts已被弃用。文档说:
This method was deprecated in API level 21. Sticky broadcasts should not be used.
They provide no security (anyone can access them), no protection (anyone can modify them), and many other problems.
The recommended pattern is to use a non-sticky broadcast to report that something has changed,
**with another mechanism for apps to retrieve the current value whenever desired**.
这种机制可能的例子是什么? 我应该采取什么方法?
答案 0 :(得分:0)
非粘性广播的示例。
android.location.PROVIDERS_CHANGED
这意味着应用程序必须检查提供程序以查看其当前状态,位置提供程序中的某些内容已更改。可能是用户在其设备中打开了GPS无线电。该应用程序不知道,直到它去检查位置提供商。
Sticky广播的另一个问题是广播消息中的信息可能是陈旧的。