Joke Collection Website - Blessing messages - What is AndroidService?

What is AndroidService?

Service, as you can see from the name, is similar to the normally understood "service". It runs in the background and can be interacted with. It is at the same level as Activity, but it cannot run by itself and needs to be called through an Activity or other Context object, Context.startService() and Context.bindService().

The two methods of starting Service are different. What I want to explain here is that if you do something that takes a lot of time in Service's onCreate or onStart, it is best to start a thread in Service to complete it, because Service runs in the main thread, which will affect your UI operations or Block other things in the main thread.

When do you need Service? For example, when playing multimedia, the user starts other activities. At this time, the program needs to continue playing in the background, such as detecting changes in files on the SD card, or recording changes in your geographical information location in the background, etc. In short, services are always hidden in Behind.