【原创】BroadcastReceiver 示例
package com.firewings.smstools; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; public class SmsReceiver extends BroadcastReceiver { private static String START_ACTION = "com.firewings.smstools.START"; private static String STOP_ACTION = "com.firewings.smstools.STOP"; @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub String action = intent.getAction(); if (STOP_ACTION.equalsIgnoreCase(action)) { context.stopService(new Intent(context, SmsListener.class)); } else { context.startService(new Intent(context, SmsListener.class)); } } }?