Bạn chỉ cần phải xác định một vài adapter đồng bộ, sử dụng các loại cùng một tài khoản.
Các biểu hiện bao gồm:
<service android:exported="true" android:name="com.example.FooSyncAdapterService">
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data android:name="android.content.SyncAdapter" android:resource="@xml/syncadapter_foo" />
</service>
<service android:exported="true" android:name="com.example.BarSyncAdapterService">
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data android:name="android.content.SyncAdapter" android:resource="@xml/syncadapter_bar" />
</service>
Và syncdataper_foo
là
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="foo"
android:accountType="com.example"
android:allowParallelSyncs="true" />
Và syncdataper_bar
là
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="bar"
android:accountType="com.example"
android:allowParallelSyncs="true" />
Lưu ý rằng trong trường hợp của các loại tài khoản "com.google", bộ điều hợp đồng bộ thậm chí được cung cấp bởi các ứng dụng khác nhau (Drive, Tài liệu, Trang tính , Gmail, Lịch, v.v.).
Cảm ơn, tôi đã cố gắng mà trước đây nhưng câu trả lời của bạn dẫn tôi đến nhận thấy bạn đã có một contentAuthority khác nhau cho mỗi SyncAdapter, đây chỉ cho tôi những vấn đề- có phải là nhiều Trình cung cấp nội dung, mỗi Trình đăng ký nội dung, mỗi đăng ký với contentAuthority được chỉ định trong tệp xml SyncAdapter. Cảm ơn rất nhiều! –
Làm cách nào tôi có thể đặt nhãn là ảnh đang được đề cập? – waldemar