Some test code
This commit is contained in:
parent
6c373b51e5
commit
2223c40c93
@ -96,7 +96,7 @@ public class MultiSmsSender extends Activity {
|
||||
long deliveryId = -1;
|
||||
ArrayList<String> messages = manager.divideMessage(message);
|
||||
int messageCount = messages.size();
|
||||
|
||||
|
||||
//showDialog(SENDING_DIALOG_KEY);
|
||||
mSendingDialog = new ProgressDialog(this);
|
||||
mSendingDialog.setTitle(R.string.sending);
|
||||
@ -106,7 +106,7 @@ public class MultiSmsSender extends Activity {
|
||||
mSendingDialog.setCancelable(false);
|
||||
mSendingDialog.setMax(size);
|
||||
mSendingDialog.show();
|
||||
|
||||
|
||||
if (haveDeliveryReports) {
|
||||
deliveryId = mDbHelper.createDelivery(message.substring(0, Math.min(30, message
|
||||
.length())).replace('\n', ' '), DateFormat.getDateInstance()
|
||||
@ -116,28 +116,32 @@ public class MultiSmsSender extends Activity {
|
||||
if (numbers.length != 0) {
|
||||
for (int i = 0; i < numbers.length; i++) {
|
||||
String newN = numbers[i].trim();
|
||||
|
||||
|
||||
if (!newN.equals("")
|
||||
&& PhoneNumberUtils.isWellFormedSmsAddress(newN)) {
|
||||
mSendingDialog.setProgress(i / size);
|
||||
|
||||
if (!allreadySend.contains(newN)) {
|
||||
allreadySend.add(newN);
|
||||
|
||||
ArrayList<PendingIntent> sentIntents = null;
|
||||
if (haveDeliveryReports) {
|
||||
|
||||
sentIntents = new ArrayList<PendingIntent>(messageCount);
|
||||
long entryId = mDbHelper.createEntry(mDbHelper.nameFromNumber(newN), newN, deliveryId);
|
||||
|
||||
ArrayList<PendingIntent> deliveryIntents = new ArrayList<PendingIntent>(messageCount);
|
||||
ArrayList<PendingIntent> sentIntents = null;
|
||||
|
||||
|
||||
|
||||
if (haveDeliveryReports) {
|
||||
long entryId = mDbHelper.createEntry(mDbHelper.nameFromNumber(newN), newN, deliveryId);
|
||||
for (int j = 0; j < messageCount; j++) {
|
||||
|
||||
Intent intent = new Intent(MessageReceiver.MESSAGE_RECEIVED, null, this, MessageReceiver.class);
|
||||
intent.putExtra(PARAM_ENTRY_ID, entryId);
|
||||
sentIntents.add(PendingIntent.getBroadcast(
|
||||
this, 0, intent , PendingIntent.FLAG_CANCEL_CURRENT));
|
||||
deliveryIntents.add(PendingIntent.getBroadcast(
|
||||
this, 0, intent , PendingIntent.FLAG_UPDATE_CURRENT));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
manager.sendMultipartTextMessage(newN, null, messages, null, sentIntents);
|
||||
manager.sendMultipartTextMessage(newN, null, messages, deliveryIntents, sentIntents);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user