0

Possible Duplicate:
Detecting SMS incoming and outgoing

I want to write a app that run silently. The app needs to be notified about new messages. It just needs to to know when a new message is received, doesn't need to read the content of the message.

How can I achieve this?

Update: Is there a function which checks if there are any new messages at a given time. My idea is to then put this check in a loop, and check for new messages regularily.

Community
  • 1
  • 1
hqt
  • 29,632
  • 51
  • 171
  • 250

2 Answers2

2

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: http://www.mail-archive.com/android-developers@googlegroups.com/msg26420.html

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

To see incoming messages you need BroadcastReceiver and persmissions: RECEIVE_SMS. here is easy tut: http://mobiforge.com/developing/story/sms-messaging-android

goodm
  • 7,275
  • 6
  • 31
  • 55