You can use services for different purposes. Generally, you use a service when no input
is required from the user. Here are some circumstances in which you might want to implement
or use an Android service:
n A weather, email, or social network app might implement a service to routinely
check for updates. (Note:There are other implementations for polling, but this is a
common use of services.)
n A photo or media app that keeps its data in sync online might implement a service
to package and upload new content in the background when the device is idle.
n A video-editing app might offload heavy processing to a queue on its service in order
to avoid affecting overall system performance for non-essential tasks.
n A news application might implement a service to "pre-load" content by downloading
news stories in advance of when the user launches the application, to improve
performance.
A good rule of thumb is that if the task requires the use of a worker thread and might affect
application responsiveness and performance, consider implementing a service to handle
the task outside the main application lifecycle.
0 件のコメント:
コメントを投稿