Search code examples
android-syncadapterandroid-authenticator

Manual sync button is missing in android sync adapter


I have created my own sync adapter . And I want to enable manual sync on it so that user can syn when they want . But the manual sync button is not showing .

enter image description here

As we can see that that there is a sync button on the left of checkbox , but in my case sync button is missing .

Here is my code for 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"/>

Here is my code for authentication account

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

What did I miss ?


Solution

  • As provided in documentation you can give the option of manual sync anywhere in your app . You have to pass in bundle with flags SYNC_EXTRAS_MANUAL or SYNC_EXTRAS_EXPEDITED

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