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="GroupEditActivity"></activity>
<activity android:name="SelectDeliveryActivity"></activity> <activity android:name="SelectDeliveryActivity"></activity>
<activity android:name="ListEntryActivity"></activity> <activity android:name="ListEntryActivity"></activity>
<receiver android:name="MessageReceiver"> <receiver android:name=".MessageReceiver" android:enabled="true" >
<intent-filter> <intent-filter>
<action android:name="com.openwide.android.mutliSmsSend.message_received"/> <action android:name="android.provider.Telephony.SMS_RECEIVED"/>
</intent-filter> </intent-filter>
</receiver> </receiver>
</application> </application>

View File

@ -7,25 +7,30 @@ import android.os.Bundle;
import android.util.Log; import android.util.Log;
public class MessageReceiver extends BroadcastReceiver{ 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 @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Log.d("------------------", "WORKING :)!!!!"); Log.d("------------------", "WORKING :)!!!!");
if (MESSAGE_RECEIVED.equals(intent.getAction())) { if (ANDROID_MESSAGE_RECEIVED.equals(intent.getAction())) {
Long entryId; Long entryId;
Bundle extras = intent.getExtras(); Bundle extras = intent.getExtras();
entryId = extras != null ? extras.getLong(MultiSmsSender.PARAM_ENTRY_ID): null; entryId = extras != null ? extras.getLong(MultiSmsSender.PARAM_ENTRY_ID): null;
//byte[] pdu = (byte[]) intent.getByteArrayExtra("pdu"); //byte[] pdu = (byte[]) intent.getByteArrayExtra("pdu");
//SmsMessage message = SmsMessage.createFromPdu(pdu); //SmsMessage message = SmsMessage.createFromPdu(pdu);
//int status = message.getStatus(); //int status = message.getStatus();
DeliveryDbAdapter mDbHelper = new DeliveryDbAdapter(context); if(entryId != null) {
mDbHelper.open(); DeliveryDbAdapter mDbHelper = new DeliveryDbAdapter(context);
mDbHelper.setEntryDelivered(entryId); mDbHelper.open();
mDbHelper.close(); mDbHelper.setEntryDelivered(entryId);
mDbHelper.close();
}
} }
} }
} }

View File

@ -89,6 +89,11 @@ public class MultiSmsSender extends Activity {
public void sendMessage() { public void sendMessage() {
MySMSManager manager = MySMSManager.getInstance(); MySMSManager manager = MySMSManager.getInstance();
String message = mEditor.getText().toString(); String message = mEditor.getText().toString();
if("".equals(message)) {
return;
}
String[] numbers = mContacts.getText().toString().split(","); String[] numbers = mContacts.getText().toString().split(",");
HashSet<String> allreadySend = new HashSet<String>(); HashSet<String> allreadySend = new HashSet<String>();
int size = numbers.length; 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 );
} }
} }