【问题标题】:Manual sync button is missing in android sync adapterandroid同步适配器中缺少手动同步按钮
【发布时间】:2015-10-03 10:27:40
【问题描述】:

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

我们可以看到复选框左侧有一个同步按钮,但在我的情况下同步按钮丢失了。

这是我的同步适配器代码

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

我错过了什么?

【问题讨论】:

    标签: android-syncadapter android-authenticator


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-24
      • 1970-01-01
      • 2013-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多