ContentProvider won't show up in Data & Synchronization area

早过忘川 提交于 2019-12-04 07:28:44
<meta-data android:name="android.content.SyncAdapater"
     android:resource="@xml/syncadapter" />

Does anyone else notice the answer?

God, I hate being an idiot.

So from a semantics perspective, Providers do not show up directly in Accounts & Sync. Instead, Accounts show up, with providers on their detail pages. So since you're binding your SyncAdapter to a com.google style account, the sync adapater will show up within your google account -- alongside "contacts" and "Calendar" and "Gmail", you should see "ClientName Books"

However, your real problem is your XML. Per AndroidManifest.xml docs,

android:name

The name of the Service subclass that implements the service. This should be a fully qualified class name (such as, "com.example.project.RoomService"). However, as a shorthand, if the first character of the name is a period (for example, ".RoomService"), it is appended to the package name specified in the

So, it looks like it's not finding your BooksProvider class because it needs the FQCN or relative path through your packages.

As I finally figured out, another reason why the ContentProvider might not be showing up under the Synchronization Settings screen is because of a missing android.permission.WRITE_SYNC_SETTINGS permission in the Manifest. Unfortunately all tutorials, articles, and documentation I've read misses this point or is not explicitly outlined. Furthermore, the platform (tested under API level 13) does not appear to throw any form of permission exception - I hope they fix this. Hopefully this helps someone.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!