@Override public int onStartCommand(Intent intent, int flags, int startId) { switch (intent.getAction()) { case PREV_ACTION: if (isFirstTime) { startService(); isFirstTime = false; } else { prevSong(); } break; case NEXT_ACTION: if (isFirstTime) { startService(); isFirstTime = false; } else { nextSong(); } break; case PLAY_ACTION: if (isFirstTime) { startService(); isFirstTime = false; } else { playSong(); } break; default: break; } return START_STICKY; }