Reputation: 297
I'm reading the documentation on developer.android.com (for example, http://developer.android.com/reference/android/content/Context.html#sendBroadcastAsUser%28android.content.Intent,%20android.os.UserHandle%29)
And I don't understand what does sending a broadcast as a user mean. I'm reading this "the user the broadcast will be sent to" but what is the user?
If it means an app, then why sendStickyBroadcastAsUser isn't safe, it should be delivered to the application and no one else.
Please give me detailed clarification with examples. Thanks!
Upvotes: 1
Views: 247
Reputation: 8621
The user is what it says it is : a user of the device. Multi-user mode was introduced in Android 4.2, so that method is there to let you specify which user "session" the broadcast Intent will received on.
Sticky broadcasts are not safe when using the multi-users mode because one user might not want his/her data shared across the device, yet sendStickyBroadcastAsUser
makes the broadcast available across all users.
Upvotes: 1