How to use CALLER_IS_SYNCADAPTER properly

前端 未结 3 652
余生分开走
余生分开走 2021-01-20 18:13

somehow I don\'t understand the working concept of the query parameter CALLER_IS_SYNCADAPTER. Its default value is false, if set, the DIRTY flag is not automatically set. So

3条回答
  •  旧巷少年郎
    2021-01-20 19:01

    Here is from Javadoc:

    /** * An optional insert, update or delete URI parameter that allows the caller * to specify that it is a sync adapter. The default value is false. If true * the dirty flag is not automatically set and the "syncToNetwork" parameter * is set to false when calling * {@link ContentResolver#notifyChange(android.net.Uri, android.database.ContentObserver, boolean)}. */

    .

    The invocation of resolver.delete(...), does not immediately delete a raw contacts row. Instead, it sets the DELETED flag on the raw contact and removes the raw contact from its aggregate contact. The sync adapter then deletes the raw contact from the server and finalizes phone-side deletion by calling resolver.delete(...) again and passing the CALLER_IS_SYNCADAPTER query parameter.

提交回复
热议问题