package github.nisrulz.service; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.support.annotation.Nullable; import android.widget.Toast; public class MyService extends Service { public MyService() { } @Nullable @Override public IBinder onBind(Intent intent) { return null; } @Override public void onCreate() { super.onCreate(); System.out.println("onCreate"); } @Override public int onStartCommand(Intent intent, int flags, int startId) { System.out.println("onStartCommand"); Toast.makeText(MyService.this, "Service Started", Toast.LENGTH_SHORT).show(); return super.onStartCommand(intent, flags, startId); } @Override public void onDestroy() { super.onDestroy(); System.out.println("onDestroy"); } }