package com.peirr.test; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.widget.Toast; public class MyService extends Service { public MyService() {} @Override public IBinder onBind(Intent intent) { // TODO: Return the communication channel to the service. throw new UnsupportedOperationException("Not yet implemented"); } @Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null) { String name = intent.getStringExtra("name"); int age = intent.getIntExtra("age",0); Toast.makeText(this, "MyService Received: [name:" + name + "] [age:" + age + "]", Toast.LENGTH_SHORT).show(); } return super.onStartCommand(intent, flags, startId); } }