I'm creating a custom Android SyncAdapter and hit a snag following the SDK example "SampleSyncAdapter". - I'm creating my equivalent of the xml/syncadapter.xml
. Here's the parts I'm confused about:
android:contentAuthority="com.android.contacts"
android:accountType="com.example.android.samplesync"
The documentation of AbstractThreadedSyncAdapter states:
The
android:contentAuthority
andandroid:accountType
attributes indicate which content authority and for which account types this sync adapter serves.
The documentation is circular in that it says nothing the name doesn't already tell you. I get the impression that both will start with my company's name com.acme.
but from there I have no clue. I suspect the strings can be anything, as long as they are globally unique so as not to conflict with any other apps that could be on the same device. I assume this means I will need to use these exact strings elsewhere in my code. However, I'd like to know, where I will need these strings?! I tried to grep for com.android.contacts
and the previously mentioned file is the only place it is used, I can find. So it is impossible to tell how the contentAuthority
is used by looking at the example.
If so, can I put them both in a string resource and reference them in by resource ID where needed? Exactly what are these attributes and how are they used? Is there any better way to figure out what values I should choose for my own application for these and other fields?