What you want to do is check the _id
last element in content://sms/sent
uri inside onChange. You need to save the previous _id (possibly in a static global variable) and compare it with the _id of the last element ( cursor.moveToLast()
) of the cursor after the request for content://sms/sent
. If _id
is the same, you can ignore the onChange call. These are a few onChange calls, which, I believe, are associated with moving sms from folder to folder during sending - outgoing, sent items, some other “invisible folders” (which we cannot know for sure, because this feature REALLY REALLY needs in proper documentation). Since you cannot listen to a more specific Uri than content://sms/sent
, you will have to implement this check for _id every time you want to detect sent sms.
If the previous _id
is different from that in your static global variable, then you send sms.
source share