I have built my own content provider. Many applications have to share this database.
But when I start my service it crashes. I didn't even get any exceptions in the log.
Looks like issue with manifest, since after I added tags realted to provider issue started.
Package:sensordata.collector
Clas name : SurveyDbProvider [SurveyDbProvider extends ContentProvider]
This is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="sensordata.collector"
android:versionCode="1"
android:versionName="1.0">
<permission
android:name="sensordata.collector.SURVEY_DATA.permission.READ"
android:label="@string/perm_label"
android:description="@string/perm_label" />
<permission
android:name="sensordata.collector.SURVEY_DATA.permission.WRITE"
android:label="@string/perm_label"
android:description="@string/perm_label" />
<uses-permission android:name="sensordata.collector开发者_运维问答.SURVEY_DATA.permission.WRITE" />
<uses-permission android:name="sensordata.collector.SURVEY_DATA.permission.READ" />
In application tag :
<provider android:name="sensordata.collector.SurveyDbProvider"
android:authorities="sensordata.collector"
android:readPermission="sensordata.collector.SURVEY_DATA.permission.READ"
android:writePermission="sensordata.collector.SURVEY_DATA.permission.WRITE" />
</application>
<uses-sdk android:minSdkVersion="4" />
</manifest>
Please help.
The authority is missing the ContentProvider name. It should be:
<provider android:name="sensordata.collector.SurveyDbProvider"
android:authorities="sensordata.collector.surveydbprovider" ... />
And as a good practice you should declare a CONTENT_URI constant matching this authority inside the provider class.
Does your provider has a public constructor ? The sensordata.collector.SurveyDbProvider has to be initializable, so it cannot be for example abstract class.
if you do not see exceptions and you are using Eclipse, press F8, maybe multiple times and check your LogCat
精彩评论