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

middle

Android Log.v() , Log.d() , Log.i() , Log.w() , Log.e() . When to use each one?

senior

What is a ThreadPool ? And is it more effective than using several separate Threads ?

middle

What is the difference between Activity and Context ?

Bình luận

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

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