I need to listen for incoming/outgoing SMS messages in the phone.
there is SMS_RECEIVED broadcast, but nothing for SMS_SEND, so I
figured I might try installing ContentObserver. I don't know how to
send message from emulator, so I tried listening for incoming messages
just for an experiment and then change content URI. Problem is -
observer is not invoked when SMS is recieved.
I do like this:
- Main activity, this is declared as a field on Main activity
private Handler handler = new Handler(); /
- onCreate method:
String url = "content://sms/inbox";
Uri uri = Uri.parse(url);
getContentResolver().registerContentObserver(uri, true, new
MyContentObserver(handler));
class MyContentObserver extends ContentObserver {
public MyContentObserver(Handler handler) {
super(handler);
}
@Override
public boolean deliverSelfNotifications() {
return false;
}
@Override
public void onChange(boolean arg0) {
super.onChange(arg0);
Log.v(TAG, "Notification on SMS observer");
}
}
- I then go to telnet, and type "sms send 5554 Hello". I see
notification popping up on the emulator that new SMS arrived, and
logging messages about "10-15 10:19:08.478: INFO/ActivityManager(50):
Stopping service: com.android.mms/.transaction.SmsReceiverService",
but not my logging message. What's wrong?
Thanks.
Denis
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---