Reputation: 4330
In the context of a music player, i have seen services being implemented in two different ways as of now.
In the first method a .aidl
file is created and a stub is generated and service is implemented from that by binding it to the main activity.
In the second method the main activity is just a UI and on starting the player from the UI the entire music playing activity is always done at the background(this method was used at android developers site).
And i have noticed using aidl is quite a popular method even though the android developers site suggests the other one. So is there any advantage of using one method over the other? Is one method more fats or efficient? Also is there any other better method that i havent come across yet? Any help will be appreciated.
Upvotes: 0
Views: 736
Reputation: 381
AIDL is more on communicating between processes while Services are way of android of running a process without getting killed.
AIDL (Andoid Interface Definition Language) There is already a question posted here that may help you understand AIDL When to use an aidl based service?
Here's Service from Andoid docs http://developer.android.com/reference/android/app/Service.html
Here's the documentation about AIDL http://developer.android.com/guide/developing/tools/aidl.html
Upvotes: 2
Reputation: 1036
I would use the Async task if your trying to play music which should be ran on a separate thread other than the UI's.
http://developer.android.com/reference/android/os/AsyncTask.html
Check out the protected methods section that will show you all the functions you need to call to update the UI.
Cheers
Upvotes: 0