Detecting SMS incoming and outgoing

soclose picture soclose · Apr 29, 2010 · Viewed 31.4k times · Source

I'd like to detect sms incoming and outgoing automatically from my application at background whenever this app is opening or not. how to code?

Answer

hcpl picture hcpl · Jun 29, 2010

This is a good tutorial on both sending and receiving sms messages: http://mobiforge.com/developing/story/sms-messaging-android .

For the incoming messages you can indeed configure a broadcastlistener for detection. *

Detecting outgoing messages is also possible (just altered this post since I dind't know this). from: http://www.mail-archive.com/[email protected]/msg26420.html

ContentResolver contentResolver = context.getContentResolver();
  contentResolver.registerContentObserver(Uri.parse("content://
sms"),true, myObserver);