How to know when sync is finished?

后端 未结 3 1879
南旧
南旧 2020-12-04 17:46

I have implemented a sync adapter and I want to get a callback when it finishes in my activity. I have tried using ContentResolver.addStatusChangeListener, but I am only get

3条回答
  •  旧时难觅i
    2020-12-04 18:42

    I was working on something similar, and I have one more Log.d at the end of the onStatusChanged function, and it wasn't executing!

    So after 15 minutes of debugging and trial on error, I realize that I need to add the READ_SYNC_STATS permission, I already have the GET_ACCOUNTS permission though. So, please check that you get the right permission, its not that the "if" doesn't becomes true, its that it bails all the time.

提交回复
热议问题