package net.wequick.example.small.appavailable_if_stub;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.util.Log;

/**
 * Created by galen on 2016/11/4.
 */
public class MyService extends Service {

    private static final String TAG = "MyService";

    @Override
    public void onCreate() {
        super.onCreate();
        Log.i(TAG, "onCreate");
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Log.i(TAG, "onDestroy");
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
}

package net.wequick.example.small.appavailable_if_stub;

import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.support.annotation.Nullable;
import android.widget.Toast;

/**
 * Created by galen on 2016/11/4.
 */
public class MyService extends Service {

    private Handler mUI;

    @Override
    public void onCreate() {
        super.onCreate();
        mUI = new Handler(Looper.myLooper());
        mUI.post(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(getApplicationContext(), "MyService is on!", Toast.LENGTH_SHORT).show();
            }
        });
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        mUI.post(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(getApplicationContext(), "MyService is off!", Toast.LENGTH_SHORT).show();
                mUI = null;
            }
        });
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
}

Add toast on server start and stop for sample
Add toast on server start and stop for sample
