package com.ldci.smsmessagedemo;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.IBinder;
import android.util.Log;
import com.util.send.Sender;
public class BackupService extends Service{ //这是服务,其主要作用就是注册广播
private String tag="aa";
SmsReceiver smsRec;
Context context;
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onCreate() {
// TODO Auto-generated method stub
smsRec=new SmsReceiver(); //实例化广播接收类,为的就是动态注册广播,以便在启动服务时,在后台一直会向广播接收器类发送短信广播action
IntentFilter filter=new IntentFilter("android.provider.Telephony.SMS_RECEIVED");
this.registerReceiver(smsRec, filter); //注册广播
super.onCreate();
}
}