Android SyncAdapter using a google account

前端 未结 1 1937
一生所求
一生所求 2020-12-12 17:40

I have written a SyncAdapter that takes a \"com.google\" account and performs a sync with an appengine web service. Testing this with the dev tools sync tester (on the emula

1条回答
  •  天命终不由人
    2020-12-12 18:13

    So it turns out you can have a syncAdapter that uses a "com.google" account, but this requires you write a matching ContentProvider. For example, in AndroidManifest.xml:

    
      
        
      
      
    
    

    and in syncadapter.xml:

    
    
    

    You then must have a ContentProvider with authority "net.gfxmonk.android.pagefeed" in order for android to associate that sync action with your application. Once you have this (it doesn't even need to do anything meaningful, just exist), your program can appear inside the "accounts & Sync" setting panel - within your chosen google account.

    As an additional piece of work, you may need to call:

    ContentResolver.setIsSyncable(account, "net.gfxmonk.android.pagefeed", 1)
    

    with account as the Account object you want to use for your sync credentials.

    0 讨论(0)
提交回复
热议问题