1

I am looking to write an automatically encrypting/decrypting sms/mms app for android. The idea to to encrypt the message and send it where it is decryption on the receiving phone.

While it is easy to automatically decrypt a message on receive, you just decrypy it, delete it, and add it again. It seems difficult to intercept a message as it is being sent and change it.

Is there anyway to read and edit a text message that is being sent right before the phone actually sends it. Thus the sending and receiving phone could have the decryption keys on them and never actually have to deal with using a different app or manual encryption, the phones would just automatically do it.

Swayam
  • 16,294
  • 14
  • 64
  • 102
ALEN TEFLER
  • 29
  • 1
  • 2

1 Answers1

1

Implement a ContentObserver on your sent messages to intercept any outgoing sms.

ContentResolver mContentResolver = context.getContentResolver();
mContentResolver.registerContentObserver(Uri.parse("content://sms/out"),true, mObserver);

Use Cursor to go to any sms and extract the body of the SMS.

Use something like

Uri smsUri = Uri.parse("content://sms/out");
Cursor mCursor = this.getContentResolver().query(smsUri, null, null, null, null);
mCursor.moveToNext();
mCursor.getString(mCursor.getColumnIndex("body"));

And have a look at this StackOverflow question..it answers your problem elaborately.

Community
  • 1
  • 1
Swayam
  • 16,294
  • 14
  • 64
  • 102