Still working on delivery reports...

This commit is contained in:
Mathieu Maret 2010-01-27 13:47:08 +01:00
parent 2223c40c93
commit e72d637222
3 changed files with 21 additions and 11 deletions

View File

@ -14,9 +14,9 @@
<activity android:name="GroupEditActivity"></activity>
<activity android:name="SelectDeliveryActivity"></activity>
<activity android:name="ListEntryActivity"></activity>
<receiver android:name="MessageReceiver">
<receiver android:name=".MessageReceiver" android:enabled="true" >
<intent-filter>
<action android:name="com.openwide.android.mutliSmsSend.message_received"/>
<action android:name="android.provider.Telephony.SMS_RECEIVED"/>
</intent-filter>
</receiver>
</application>

View File

@ -7,22 +7,27 @@ 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();
}
}
}

View File

@ -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<String> allreadySend = new HashSet<String>();
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 );
}
}