سؤال

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?

هل كانت مفيدة؟

المحلول

Use

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

and check the type of the cursor

Here is an example code.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top