android 同步适配器中缺少手动同步按钮

Manual sync button is missing in android sync adapter

我已经创建了自己的同步适配器。我想在上面启用手动同步,以便用户可以在需要时进行同步。但是手动同步按钮没有显示。

正如我们所见,复选框左侧有一个同步按钮,但在我的例子中没有同步按钮。

这是我的同步适配器代码

<?xml version="1.0" encoding="utf-8"?>
<sync-adapter
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:contentAuthority="com.ex.MyApplication"
    android:accountType="com.ex.MyApplication"
    android:userVisible="true"
    android:supportsUploading="true"
    android:allowParallelSyncs="true"
    android:isAlwaysSyncable="true"/>

这是我的验证码

<?xml version="1.0" encoding="utf-8"?>
<account-authenticator
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountType="com.ex.MyApplication"
    android:icon="@drawable/ic_running"
    android:smallIcon="@drawable/ic_running"
    android:label="@string/app_name"/>

我错过了什么?

如文档中所述,您可以在应用的任何位置提供手动同步选项。您必须传入带有标志 SYNC_EXTRAS_MANUAL 或 SYNC_EXTRAS_EXPEDITED

的捆绑包

https://developer.android.com/training/sync-adapters/running-sync-adapter.html#RunOnDemand