I've currently written an app that is observing the content://sms URI for any changes to the database. My observer is successfully being triggered when individual messages are added or removed, however, no notification is triggered when an entire thread is deleted at once. Is there any way to get this event to trigger? Or maybe there's another content provider I should be observing?
Uri URI = Uri.parse("content://sms");
String[] columns = {"_id", "date"};
Cursor c = getContentResolver().query(URI, columns, "type=?", new开发者_C百科 String[]{"1"}, "_id DESC");
Observer observer = new Observer();
c.registerContentObserver(observer);
And my observer class:
private class Observer extends ContentObserver {
    public Observer() {
        super(null);
    }
    @Override
    public void onChange(boolean selfChange) {
        super.onChange(selfChange);
        if (!selfChange) {
            // do stuff
            // never called when a thread is deleted
        }
    }
}
I switched to observing the content://mms-sms/conversations content provider. This provider properly signals my observer when a thread is deleted.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论