This might be a simple question, but I’ve had a hard time pinning down a direct answer.
I have created a content provider in its own separate package in a project using the Eclipse Android ADT. This package is included in the src of the overall project. When modifying AndroidManifest.xml I included this as a child of <application>:
<provider android:name="JobProvider"
android:authorities="dsndata.sds2Mobile.provider.JobProvider" />
The code that will be using the provider is in a separate package also in src
Where would be the best place to store the provider? In the same package as the source using it? Also, What are the correct values for android:name and android:authorities? I’m sure they vary depending on where the provider is stored.
You can place the provider wherever you like. If you are writing a provider that stores data for your app (and only for your app, and only your app uses it) then it’s cleanest to just be right in with the app code in its own package. Typically, ‘provider’ is the package name.
As for the name and authority, see the Manifest documentation:
The content authority is a unique string that is used to map content:// uris (uri to data) to your class. ContentResolver uses that mapping to identify how to serve a given request, which is identified with a URI, to the correct class (yours). Hence the requirements for a unique string.