Put your app account in Auto-Sync settings android

2019-08-16 01:17发布

问题:

I am new on this so i do not find the answer on the internet or i am not sure if the answer is that. What i am trying to do is to make my app sync all the contacts in the native contact app like whatsapp or facebook does. I also wanted to link contacts. Any hint or tutorial would be great.

Something like this:

What are the benefits of putting my app over there? I am very new on this. Please I hope an answer do not vote down D:. Any answer is welcome.

回答1:

Account Manager requires several key api's to work with your app.

Just to show your App account

  • Authenticator Activtiy which extends AbstractAccountAuthenticator
  • Service Activity which Bind's with Authenticator
  • An xml file in RES/XML folder
  • Some Settings in Android Manifest.

Read this https://www.finalconcept.com.au/article/view/android-account-manager-step-by-step

To Auto Sync your Account;

  • SyncAdapter Class which extends AbstractThreadedSyncAdapter
  • SyncService which extends Service
  • an xml file , which defines metadata for SyncAdapter
  • Permission in Android Manifest
  • Optionally Content Provider Class

Offical Android Developer Tutorial https://developer.android.com/training/sync-adapters/index.html

Another Fully Detailed answer (With Examples) : Android Login - Account Authenticator vs Manual Authentication