Question

I am trying to create a ContentObserver that will inform me when an SMS is sent from my device. When I use the following my onChange() gets called:

public static final Uri uriSMS = Uri.parse("content://sms");

However, when I try to limit it to just sent SMS messages using this:

public static final Uri uriSMS = Uri.parse("content://sms/sent");

it does not work; the onChange() method simply doesn't get called. Can anyone help me troubleshoot this?

Était-ce utile?

La solution

Use

public static final Uri uriSMS = Uri.parse("content://sms");

and check the type of the cursor

Here is an example code.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top