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

Describe different types of Services in Android

Câu trả lời

There are three main types of services in Android:

  1. Foreground Services: These services perform operations that are noticeable to the user, such as playing music in an app like Spotify[1][4]. Foreground services must display a persistent notification to the user[1].

  2. Background Services: These services perform operations in the background without the user's knowledge, such as scheduled data syncing[1][4]. Background services do not display notifications to the user[4].

  3. Bound Services: These services allow application components like activities to bind to them using the bindService() method[1][4]. Bound services provide a client-server interface for interacting with the service, allowing components to send requests, receive results, and perform interprocess communication (IPC)[1][2]. Bound services run until all bound components unbind[1].

Services can be started by calling startService() which puts the service in a started state[1][4]. The service runs in the background even if the component that started it is destroyed[4]. To stop a started service, you can call stopService() or the service can stop itself by calling stopSelf()[1][4].

Bound services are started when a component calls `b...

middle

middle

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

junior

What is Armv7?

middle

What are Android Annotations and what are they used for?

middle

When to use Android Loaders?

Bình luận

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

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