I'm trying to write a synchronization adapter with "StubProvider" and "StubAuthenticator", I followed the official recommendations, my code works without any errors, but "onPerformSync ()" DOES NOT receive the call, I tried everything but did not use it.
My full project can be downloaded from https://www.dropbox.com/s/48bgj3wweehaieu/MyApplication.zip?dl=0
Here are the classes I use:
Class MainActivity
public class MainActivity extends FragmentActivity implements View.OnClickListener {
Class for authentication stubs
public class Authenticator extends AbstractAccountAuthenticator {
Class AuthenticatorService
public class AuthenticatorService extends Service {
Class SyncService
public class SyncService extends Service {
Class StubProvider
public class StubProvider extends ContentProvider { @Override public boolean onCreate() { return true; } @Override public String getType(Uri uri) { return null; } @Override public Cursor query( Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { return null; } @Override public Uri insert(Uri uri, ContentValues values) { return null; } @Override public int delete(Uri uri, String selection, String[] selectionArgs) { return 0; } public int update( Uri uri, ContentValues values, String selection, String[] selectionArgs) { return 0; } }
SyncAdapter Class
public class SyncAdapter extends AbstractThreadedSyncAdapter { private final AccountManager mAccountManager; public SyncAdapter(Context context, boolean autoInitialize) { super(context, autoInitialize); mAccountManager = AccountManager.get(context); } @Override public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { Log.d("udinic", "onPerformSync for account[" + account.name + "]"); try {