@Override public int onStartCommand(Intent intent, int flags, int startId) { // Display notification in the notification bar createNotification(); // Start playing music mPlayer.start(); Toast.makeText(this, "Service Started", Toast.LENGTH_SHORT).show(); return Service.START_STICKY; // Service will be explicitly started and stopped as needed. }