0

I have GoogleAccountCredential object from google api that i create in my activity and i need it in my sync adapter.How can i send it to there?I suppose synchronization take place in another process ,so it is possible to have object from activity in sync adapter's onperfromsync method?

Lester
  • 2,544
  • 4
  • 27
  • 38

1 Answers1

2

You can use 3rd param of ContentResolver.requestSync to pass arguments to your SyncAdapter. They will be available in extras Bundle in onPerformSync callback in your sync adapter.

You cannot pass any object using this method (see requestSync docs), but it migth be good enough for your use case (for example you can pass Account objects).

chalup
  • 8,358
  • 3
  • 33
  • 38
  • I dont need account object, i need GoogleAccountCredential object.Its for possibility to use app engine endpoints methods with auth. – Lester May 12 '14 at 08:58
  • I'm not familiar with that API, but I guess you're out of luck (or you have to resort to passing this object through some static variable). – chalup May 12 '14 at 08:59
  • thanks for answers.I will try static variable but as i say is suppose that sync runs on another process so this variable will be not available. – Lester May 12 '14 at 09:03
  • SyncAdapter works in another thread, but by default it's still in the same process as the main application. – chalup May 12 '14 at 09:11