Hi Himanshu,

1) SampleSyncAdapter is still a good source of inspiration.  It has some
issues and plan to have them fixed in the nearest future.

2) In releases of Android from Eclair through Gingerbread integrated editing
of 3rd party contacts is poorly supported.  The trick is to insert a data
row, "Edit in MyApp", which would take the user to your app and your app
would then provide an editor activity.  Also, there is no provision in the
Contacts UI for creating new contacts in 3rd party accounts.  We have fixed
those issues in Honeycomb.  Now you can specify two activities in your
metadata xml file: one for creating new contacts and one for editing
existing ones and voilĂ ! - you have seamless integration.  Of course, it's a
bit too soon to rely on Honeycomb as the dominant version of Android ;-)  So
for now you will need to either go with the described hack or only allow
creation/editing of contacts through your app.

3) Please consider an alternative to using content observers for a sync
adapter.  There are several reasons:

- In order to receive notifications, your process will need to be running at
all times. Or it would have to have a broadcast receiver, which is very very
costly.
- Content observer notifications are not reliable.  If your process is not
running at the time the change occurs, the notification will never be
delivered.  A broadcast receiver will solve that problem, but please don't
use broadcast receivers for this!
- Contacts provider sends out non-discriminated notifications.  Whenever
anything (e.g. chat presence) changes, all observers are notified whether
they have supplied a specific URI or not.

What you do want to use is the DIRTY flag and the CALLER_IS_SYNCADAPTER
query parameter and let SyncManager invoke your sync adapter.  It does some
sophisticated scheduling and you want to take advantage of it.

Cheers,
- Dmitri


On Fri, Jan 28, 2011 at 4:22 PM, himanshu jain <himanshu....@gmail.com>wrote:

> Hi All,
>
> I am trying to implement two way sync.
>
> 1) I tried using SampleSyncAdapter Code first it works on emulator but
> not on Device , then i tried to write SyncAdapter with SyncService as
> a demo app with AccountAuthenticator, as per Documentation for
> SampleSyncAdapter SyncService gets called on
> ACTION_AUTHENTICATOR_INTENT but my service does not gets started on
> device , i defined service in manifest and all things but does not
> work on device it gets started on Emulator.
>
> 2) If i port my app on device i can see only first name and last name
> fields how can i see all the fields available for contact
> application ?? can i edit them also utilizing the same native
> editor??.
>
> 3) I planning to add contentobserver for sync from device to cloud
> whenever there is change corresponding to my account in contact table
> i want to sync it after listening through contentobserver.Is that
> correct ??.
>
> thanks
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to