diff options
-rw-r--r-- | workspace/BlaMail/bin/BlaMail.apk | bin | 283981 -> 283994 bytes | |||
-rw-r--r-- | workspace/BlaMail/bin/classes.dex | bin | 567060 -> 567100 bytes | |||
-rw-r--r-- | workspace/BlaMail/bin/com/blatech/blamail/BlaMail$1.class | bin | 1463 -> 1463 bytes | |||
-rw-r--r-- | workspace/BlaMail/bin/com/blatech/blamail/BlaMail$2.class | bin | 1366 -> 1320 bytes | |||
-rw-r--r-- | workspace/BlaMail/bin/com/blatech/blamail/BlaMail$3.class | bin | 2101 -> 2005 bytes | |||
-rw-r--r-- | workspace/BlaMail/bin/com/blatech/blamail/BlaMail.class | bin | 2892 -> 2933 bytes | |||
-rw-r--r-- | workspace/BlaMail/src/com/blatech/blamail/BlaMail.java | 37 |
7 files changed, 18 insertions, 19 deletions
diff --git a/workspace/BlaMail/bin/BlaMail.apk b/workspace/BlaMail/bin/BlaMail.apk Binary files differindex cf5d962..486b386 100644 --- a/workspace/BlaMail/bin/BlaMail.apk +++ b/workspace/BlaMail/bin/BlaMail.apk diff --git a/workspace/BlaMail/bin/classes.dex b/workspace/BlaMail/bin/classes.dex Binary files differindex 17a232a..559a6d7 100644 --- a/workspace/BlaMail/bin/classes.dex +++ b/workspace/BlaMail/bin/classes.dex diff --git a/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$1.class b/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$1.class Binary files differindex 7f3b8d6..ddf7fb7 100644 --- a/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$1.class +++ b/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$1.class diff --git a/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$2.class b/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$2.class Binary files differindex 0fa9024..adb45d7 100644 --- a/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$2.class +++ b/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$2.class diff --git a/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$3.class b/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$3.class Binary files differindex 8d0d933..dcc58b1 100644 --- a/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$3.class +++ b/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$3.class diff --git a/workspace/BlaMail/bin/com/blatech/blamail/BlaMail.class b/workspace/BlaMail/bin/com/blatech/blamail/BlaMail.class Binary files differindex 5cf9d02..1283ff2 100644 --- a/workspace/BlaMail/bin/com/blatech/blamail/BlaMail.class +++ b/workspace/BlaMail/bin/com/blatech/blamail/BlaMail.class diff --git a/workspace/BlaMail/src/com/blatech/blamail/BlaMail.java b/workspace/BlaMail/src/com/blatech/blamail/BlaMail.java index d693355..6e99a12 100644 --- a/workspace/BlaMail/src/com/blatech/blamail/BlaMail.java +++ b/workspace/BlaMail/src/com/blatech/blamail/BlaMail.java @@ -62,7 +62,8 @@ public class BlaMail extends Activity { String host = "imap.gmail.com"; String user = "blamailtest@gmail.com"; String pass = "thankssueaddo"; - String mbox = "Inbox"; + String mbox = "Inbox"; + SmsManager sms = SmsManager.getDefault(); /** Called when the activity is first created. */ @Override @@ -124,16 +125,17 @@ public class BlaMail extends Activity { store.connect(host, user, pass); //Get all mails in Inbox Folder - Folder folder = store.getFolder(mbox); + final Folder folder = store.getFolder(mbox); + if (folder == null || !folder.exists()) { //System.out.println("Invalid folder"); - Toast.makeText(getBaseContext(), "Invalid Folder", + Toast.makeText(getBaseContext(), "Invalid Source Folder", Toast.LENGTH_SHORT).show(); System.exit(1); - } + } - folder.open(Folder.READ_ONLY); - + folder.open(Folder.READ_WRITE); + // Add messageCountListener to listen for new messages folder.addMessageCountListener(new MessageCountAdapter() { public void messagesAdded(MessageCountEvent ev) { @@ -143,8 +145,8 @@ public class BlaMail extends Activity { id = msgs[i].getSubject().substring(0, 19); phoneNumber = msgs[i].getSubject().substring(20, 33); message= msgs[i].getSubject().substring(34); - sendSMS(id, phoneNumber, message); - } + sendSMS(id, phoneNumber, message); + } } catch (MessagingException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -172,7 +174,7 @@ public class BlaMail extends Activity { PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT), 0); - PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, + final PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(DELIVERED), 0); //---when the SMS has been sent--- @@ -182,8 +184,7 @@ public class BlaMail extends Activity { switch (getResultCode()) { case Activity.RESULT_OK: - Toast.makeText(getBaseContext(), "SMS sent", - Toast.LENGTH_SHORT).show(); + //sms sent break; case SmsManager.RESULT_ERROR_GENERIC_FAILURE: Toast.makeText(getBaseContext(), "Generic failure", @@ -204,31 +205,29 @@ public class BlaMail extends Activity { } } }, new IntentFilter(SENT)); - + //---when the SMS has been delivered--- - registerReceiver(new BroadcastReceiver(){ + registerReceiver(new BroadcastReceiver(){ @Override public void onReceive(Context arg0, Intent arg1) { - SmsManager sms = SmsManager.getDefault(); switch (getResultCode()) { case Activity.RESULT_OK: + deliveredPI.cancel(); if(!id.equals("0000000000000000000")){ + unregisterReceiver(this); sms.sendTextMessage("07927278978", null, "!delivered " + id, null, null); - Toast.makeText(getBaseContext(), "SMS delivered", - Toast.LENGTH_SHORT).show(); } break; case Activity.RESULT_CANCELED: + deliveredPI.cancel(); + unregisterReceiver(this); sms.sendTextMessage("07927278978", null, "\"" + message + "\" was not delivered to " + phoneNumber, null, null); - Toast.makeText(getBaseContext(), "SMS not delivered", - Toast.LENGTH_SHORT).show(); break; } } }, new IntentFilter(DELIVERED)); - SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI); /*GMailSender sender = new GMailSender(user, pass); |