summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--workspace/BlaMail/bin/BlaMail.apkbin283981 -> 283994 bytes
-rw-r--r--workspace/BlaMail/bin/classes.dexbin567060 -> 567100 bytes
-rw-r--r--workspace/BlaMail/bin/com/blatech/blamail/BlaMail$1.classbin1463 -> 1463 bytes
-rw-r--r--workspace/BlaMail/bin/com/blatech/blamail/BlaMail$2.classbin1366 -> 1320 bytes
-rw-r--r--workspace/BlaMail/bin/com/blatech/blamail/BlaMail$3.classbin2101 -> 2005 bytes
-rw-r--r--workspace/BlaMail/bin/com/blatech/blamail/BlaMail.classbin2892 -> 2933 bytes
-rw-r--r--workspace/BlaMail/src/com/blatech/blamail/BlaMail.java37
7 files changed, 18 insertions, 19 deletions
diff --git a/workspace/BlaMail/bin/BlaMail.apk b/workspace/BlaMail/bin/BlaMail.apk
index cf5d962..486b386 100644
--- a/workspace/BlaMail/bin/BlaMail.apk
+++ b/workspace/BlaMail/bin/BlaMail.apk
Binary files differ
diff --git a/workspace/BlaMail/bin/classes.dex b/workspace/BlaMail/bin/classes.dex
index 17a232a..559a6d7 100644
--- a/workspace/BlaMail/bin/classes.dex
+++ b/workspace/BlaMail/bin/classes.dex
Binary files differ
diff --git a/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$1.class b/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$1.class
index 7f3b8d6..ddf7fb7 100644
--- a/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$1.class
+++ b/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$1.class
Binary files differ
diff --git a/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$2.class b/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$2.class
index 0fa9024..adb45d7 100644
--- a/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$2.class
+++ b/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$2.class
Binary files differ
diff --git a/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$3.class b/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$3.class
index 8d0d933..dcc58b1 100644
--- a/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$3.class
+++ b/workspace/BlaMail/bin/com/blatech/blamail/BlaMail$3.class
Binary files differ
diff --git a/workspace/BlaMail/bin/com/blatech/blamail/BlaMail.class b/workspace/BlaMail/bin/com/blatech/blamail/BlaMail.class
index 5cf9d02..1283ff2 100644
--- a/workspace/BlaMail/bin/com/blatech/blamail/BlaMail.class
+++ b/workspace/BlaMail/bin/com/blatech/blamail/BlaMail.class
Binary files differ
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);