package gr.mybook.myremoteservice;

import android.app.Service;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.widget.Toast;

public class myRemoteService extends Service {
    final Messenger myMessenger = new Messenger(new ServiceHandler());

	class ServiceHandler extends Handler {
           @Override
	    public void handleMessage(Message msg) {
            // Get message (date & time) from client
	        Bundle b = msg.getData();
	        String data = b.getString("key");
	        Toast.makeText(getBaseContext(), data, Toast.LENGTH_LONG).show();
           }
       }

	@Override
	public IBinder onBind(Intent intent) {
		return myMessenger.getBinder();
	}

}
