0
我已開始使用android同步適配器併成功創建了一個工作同步適配器。 bt我的查詢是,如何可以使多個同步適配器,就像我有兩個表,我想爲每個表兩個不同的同步適配器。如何在Android中創建多個同步適配器
我已開始使用android同步適配器併成功創建了一個工作同步適配器。 bt我的查詢是,如何可以使多個同步適配器,就像我有兩個表,我想爲每個表兩個不同的同步適配器。如何在Android中創建多個同步適配器
這可能是遲到的回覆,但它可以幫助他人。
創建具有不同的內容提供
<service android:exported="true" android:name="com.sync.Sync1AdapterService">
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data android:name="android.content.SyncAdapter" android:resource="@xml/sync_adapter1" />
</service>
<service android:exported="true" android:name="com.example.Sync2AdapterService">
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data android:name="android.content.SyncAdapter" android:resource="@xml/sync_adapter2" />
</service>
sync_adapter1
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="sync1"
android:accountType="com.sync.example"
android:allowParallelSyncs="true" />
sync_adapter2
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="sync2"
android:accountType="com.sync.example"
android:allowParallelSyncs="true" />
多個同步適配器