49 lines
1.4 KiB
Java
49 lines
1.4 KiB
Java
package com.hectorone.multismssender;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.ContentValues;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.net.Uri;
|
|
import android.util.Log;
|
|
|
|
public class MessageReceiver extends BroadcastReceiver{
|
|
public static final String MESSAGE_RECEIVED = "com.hectorone.multismssender.SMS_RECEIVED";
|
|
public static final String ANDROID_MESSAGE_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";
|
|
public static final String DEBUG_TAG="-------MessageReceiver--------";
|
|
|
|
@Override
|
|
public void onReceive(Context context, Intent intent) {
|
|
|
|
|
|
if (MESSAGE_RECEIVED.equals(intent.getAction())) {
|
|
Log.d(DEBUG_TAG, "SMS_RECEIVED");
|
|
|
|
Uri entryURI = intent.getData();
|
|
if (entryURI != null){
|
|
ContentValues values = new ContentValues(1);
|
|
values.put(DeliveryDbAdapter.KEY_DELIVERY_ENTRY_DELIVERED, 1);
|
|
context.getContentResolver().update(entryURI, values, null, null);
|
|
|
|
}
|
|
/*String entryStr = entryURI.getLastPathSegment();
|
|
entryId = Long.parseLong(entryStr);*/
|
|
|
|
//byte[] pdu = (byte[]) intent.getByteArrayExtra("pdu");
|
|
//SmsMessage message = SmsMessage.createFromPdu(pdu);
|
|
//int status = message.getStatus();
|
|
|
|
|
|
/*if(entryId != null) {
|
|
DeliveryDbAdapter mDbHelper = new DeliveryDbAdapter(context);
|
|
mDbHelper.open();
|
|
mDbHelper.setEntryDelivered(entryId);
|
|
mDbHelper.close();
|
|
}*/
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|