Вопрос

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