Services in Android

  • service is a component that runs in the background to perform long-running operations
  • To perform work for remote processes.
  • Runs in Background (No Interfaces)
Eg :com.android.music.MediaPlaybackService    
public class BackgroundSoundService extends Service { private static final String TAG = null; MediaPlayer player; public IBinder onBind(Intent arg0) { return null; } @Override public void onCreate() { super.onCreate(); player = MediaPlayer.create(this, R.raw.song); player.setLooping(true); // Set looping player.setVolume(100,100); } public int onStartCommand(Intent intent, int flags, int startId) { player.start(); return Service.START_STICKY; } @Override public void onDestroy() { player.stop(); player.release(); } }
   
 

21 Comments

  1. Hi there, I discovered your blog by way of Google even as looking for a comparable
    matter, your site got here up, it looks good. I’ve bookmarked it in my google
    bookmarks.[X-N-E-W-L-I-N-S-P-I-N-X]Hello there, simply was aware of
    your blog through Google, and located that it’s truly informative.
    I’m going to watch out for brussels. I will be grateful should you proceed this in future.
    A lot of folks will be benefited from your writing.
    Cheers!

  2. of course like your website however you have to test the spelling on quite a few
    of your posts. Many of them are rife with spelling issues and I to find it very troublesome to
    tell the reality then again I will definitely come back
    again.

  3. Hi, I do believe this is an excellent web site. I stumbledupon it 😉 I may come back yet again since i
    have book-marked it. Money and freedom is the best way to change, may you be rich
    and continue to guide others.

  4. Definitely believe that that you stated.

    Your favorite reason appeared to be at the web
    the simplest factor to take into accout of.

    I say to you, I certainly get annoyed at the same time as
    folks think about worries that they plainly don’t know
    about. You managed to hit the nail upon the top and
    defined out the entire thing with no need side effect , folks can take a signal.
    Will likely be back to get more. Thank you

  5. Hey, I think your blog might be having browser compatibility
    issues. When I look at your blog site in Opera, it looks fine but when opening in Internet
    Explorer, it has some overlapping. I just wanted to give you a quick heads up!

    Other then that, very good blog!

  6. Hi! I just wanted to ask if you ever have any trouble with hackers?
    My last blog (wordpress) was hacked and I ended up losing months of hard work
    due to no data backup. Do you have any methods to protect against hackers?

  7. I really like what you guys tend to be up too. This sort of clever work and reporting!
    Keep up the good works guys I’ve incorporated you guys to my personal blogroll.

  8. Woah! I’m really digging the template/theme of this blog.
    It’s simple, yet effective. A lot of times it’s difficult to get that
    “perfect balance” between superb usability and visual appearance.
    I must say you’ve done a great job with this. In addition, the blog loads super quick for me on Firefox.
    Superb Blog!

  9. Please let me know if you’re looking for
    a article author for your blog. You have some really
    great articles and I feel I would be a good asset. If you
    ever want to take some of the load off, I’d love to write some content for your blog in exchange for a link back to mine.
    Please send me an email if interested. Thanks!

  10. Auto Like, Autoliker, Photo Auto Liker, Working Auto Liker, Increase Likes, Auto Liker, Autolike, Status Auto Liker, auto like, Photo Liker, auto liker, Autoliker, autoliker, autolike, Autolike International, ZFN Liker, Status Liker

2 Trackbacks / Pingbacks

  1. Google
  2. Google

Leave a Reply

Your email address will not be published.


*