Câu hỏi phỏng vấn Android
Câu hỏi

What is a Stic...

Câu trả lời

A Sticky Broadcast is a special type of broadcast in Android where the sent Intent object remains in a cache even after the broadcast is complete. The system may re-broadcast sticky Intents to later registrations of receivers[1][2].

Some key points about Sticky Broadcasts:

  • They allow communication between a function and a service[1]
  • They are sent using sendStickyBroadcast() which performs a sendBroadcast(Intent) known as sticky[1]
  • The Intent stays around after the broadcast is complete, so others can quickly retrieve that data through the return value of registerReceiver(BroadcastReceiver, IntentFilter)[1]
  • For example, you can use a sticky broadcast for ACTION_BATTERY_CHANGED to get battery change events without registering for all future state changes[1]

However, sticky broadcasts have some security issues[2]:

  • They cannot be res...
senior

senior

Gợi ý câu hỏi phỏng vấn

senior

What are Android Architecture Components?

senior

Discuss Singletons vs. Application Context for app-global state

middle

What is DDMS and what can you do with it?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào