From e72d637222b52d488177336954b9391e80380ed5 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Wed, 27 Jan 2010 13:47:08 +0100 Subject: [PATCH] Still working on delivery reports... --- AndroidManifest.xml | 4 ++-- src/com/openwide/android/MessageReceiver.java | 21 ++++++++++++------- src/com/openwide/android/MultiSmsSender.java | 7 ++++++- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 43b8d0f..e330d77 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -14,9 +14,9 @@ - + - + diff --git a/src/com/openwide/android/MessageReceiver.java b/src/com/openwide/android/MessageReceiver.java index a00555d..6af3641 100644 --- a/src/com/openwide/android/MessageReceiver.java +++ b/src/com/openwide/android/MessageReceiver.java @@ -7,25 +7,30 @@ import android.os.Bundle; import android.util.Log; public class MessageReceiver extends BroadcastReceiver{ - public static final String MESSAGE_RECEIVED = "com.openwide.android.mutliSmsSend.message_received"; + public static final String MESSAGE_RECEIVED = "com.openwide.android.SMS_RECEIVED"; + public static final String ANDROID_MESSAGE_RECEIVED = "android.provider.Telephony.SMS_RECEIVED"; @Override public void onReceive(Context context, Intent intent) { + + Log.d("------------------", "WORKING :)!!!!"); - if (MESSAGE_RECEIVED.equals(intent.getAction())) { + if (ANDROID_MESSAGE_RECEIVED.equals(intent.getAction())) { Long entryId; Bundle extras = intent.getExtras(); entryId = extras != null ? extras.getLong(MultiSmsSender.PARAM_ENTRY_ID): null; //byte[] pdu = (byte[]) intent.getByteArrayExtra("pdu"); //SmsMessage message = SmsMessage.createFromPdu(pdu); - //int status = message.getStatus(); - DeliveryDbAdapter mDbHelper = new DeliveryDbAdapter(context); - mDbHelper.open(); - mDbHelper.setEntryDelivered(entryId); - mDbHelper.close(); + //int status = message.getStatus(); + if(entryId != null) { + DeliveryDbAdapter mDbHelper = new DeliveryDbAdapter(context); + mDbHelper.open(); + mDbHelper.setEntryDelivered(entryId); + mDbHelper.close(); + } } } - + } diff --git a/src/com/openwide/android/MultiSmsSender.java b/src/com/openwide/android/MultiSmsSender.java index 882b916..01e55ec 100644 --- a/src/com/openwide/android/MultiSmsSender.java +++ b/src/com/openwide/android/MultiSmsSender.java @@ -89,6 +89,11 @@ public class MultiSmsSender extends Activity { public void sendMessage() { MySMSManager manager = MySMSManager.getInstance(); String message = mEditor.getText().toString(); + + if("".equals(message)) { + return; + } + String[] numbers = mContacts.getText().toString().split(","); HashSet allreadySend = new HashSet(); int size = numbers.length; @@ -141,7 +146,7 @@ public class MultiSmsSender extends Activity { } - manager.sendMultipartTextMessage(newN, null, messages, deliveryIntents, sentIntents); + manager.sendMultipartTextMessage(newN, null, messages, sentIntents, deliveryIntents ); } }