package com.agniva.smsblocker;

import android.app.Service;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.IBinder;
import android.util.Log;

public class SMSService extends Service
{
    private SMSReceiver mSMSreceiver;
    private IntentFilter mIntentFilter;
    private final String TAG = this.getClass().getSimpleName();

    @Override
    public void onCreate()
    {
        super.onCreate();
        Log.i(TAG, "Service started");
        //SMS event receiver
        mSMSreceiver = new SMSReceiver();
        mIntentFilter = new IntentFilter();
        mIntentFilter.addAction("android.provider.Telephony.SMS_RECEIVED");
        Log.i(TAG, "Registering receiver");
        registerReceiver(mSMSreceiver, mIntentFilter);
    }

    @Override
    public void onDestroy()
    {
        super.onDestroy();

        // Unregister the SMS receiver
        unregisterReceiver(mSMSreceiver);
    }

    @Override
    public IBinder onBind(Intent intent) {
        // We don't provide binding, so return null
        return null;
    }
}
