簡體   English   中英

如何在Android中創建多個同步適配器

[英]How to Create Multiple Sync Adapters in Android

我已經在android同步適配器上啟動並成功創建了一個工作同步適配器。 bt我的查詢是,如何制作多個同步適配器,例如我有兩個表,並且我想為每個表使用兩個不同的同步適配器。

可能回復晚了,但可以幫助其他人。

使用不同的內容提供商創建多個同步適配器

<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" />

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM