Contacts FAQ?

by jarkman » Thu, 19 Nov 2009 18:27:28 GMT

Sponsored Links
 GDroid - here's a recipe for supporting two SDK versions in one app:

Contacts FAQ?

by GDroid » Sun, 22 Nov 2009 19:42:19 GMT

 Thanks jarkman. I've continued the discussion in the thread you have

Sponsored Links

Contacts FAQ?

by bcavagnolo » Wed, 09 Dec 2009 06:41:50 GMT

 I've got a question related to #8 "How do I add an Account type, a'la
Facebook, so that I can sync contact data in from MySpace/Livejournal/
whatever."  This seems like the best thread so far to ask it:

My goal is to have the stock android Contacts app create a full
fledged contact with Name, Phone, Email, etc., for my custom account
type.  After some code reading and experimentation, I understand how
programmers are meant to register a new account type, provide a sync
adapter for that account type, and provide an xml CONTACTS_STRUCTURE
for that account type.  I have all of this working, so I am able to
create a new account and add contacts all from the Contacts app.
However, the only editable fields that appear when I create a contact
are "Given name" and "Family name."

A close read of packages/apps/Contacts/src/com/android/contacts/model/ reveals that the EditField and EditTypes info in
CONTACTS_STRUCTURE xml file are not being parsed.  So the fields I
specify in my CONTACTS_STRUCTURE do not appear in the UI.  Will this
functionality be implemented and released in the near term?  ...or am
I missing something?

Also, are there any other sample CONTACTS_STRUCTURE files besides the
comments in



Contacts FAQ?

by Brian Cavagnolo » Thu, 10 Dec 2009 11:28:17 GMT

 ydario: please keep the public discourse public:

You need two meta-data entries: one for the CONTACTS_STRUCTURE and one
for the sync adapter.  Something like this:

                <service android:exported="true"
                        <action android:name="android.content.SyncAdapter"/>
                        <meta-data android:name="android.content.SyncAdapter"

                                android:resource="@xml/contacts" />

See the (limited) sync adapter documentation for details on preparing

Of course the original question still stands: The fields that you
specify in res/xml/contacts.xml don't come up in the contacts app.  It
appears that the code that processes the actual fields is not in
place.  Of course this may not matter for folks who don't wish to use
the stock android Contacts app to edit the custom fields.



Contacts FAQ?

by ydario » Thu, 10 Dec 2009 23:03:31 GMT


ah, I wonder why I didn't do this... maybe being around midnight does
not help ;-)

very limited.

here I think I still have to reach this level. When I open a contact,
here the Contacts Activity stops because it is unable to find an

I tried adding contacts code to this project 

but it still fails because contacts.model.Sources.findAuthenticator
does not work.

I'm using the 2.0.1 emulator, not a real phone, I don't know if this
makes a difference (but account_type is empty on the database).




Contacts FAQ?

by Brian Cavagnolo » Fri, 11 Dec 2009 01:25:49 GMT


When you navigate to Contacts->[menu]->Accounts->AddAccount or
Settings->Accounts & sync->Add Account does your custom account type
appear?  If not, this is probably your next milestone.  I achieved
this by reading the code in packages/apps/Email/, which is a far cry
from a gentle introduction to this stuff.  Also, the actual Account
Settings activity in packages/providers/GoogleSubscribedFeedsProvider/
plays a pivotal role in all of this.  (You'd think that activity would
be in a more prominent place like in the actual Settings app.)

I'm using the head of the public repo, not the SDK.  I'm not sure if
there's any differences.



Contacts FAQ?

by ydario » Fri, 11 Dec 2009 18:57:35 GMT


thanks for pointer.

But here gets my question: if I add an authenticator, the phone will
end having at least two of them, mine and google one.
Will I be able to access also google contacts?
after looking at rawcontacts fields, it seems to me that every account
is tied to one authenticator, so I will not have access to standard

What is your experience regard this?




Contacts FAQ?

by Brian Cavagnolo » Sat, 12 Dec 2009 05:40:23 GMT


Excellent question.  I've been learning the answer the hard way:)
Here's how it works: Suppose I have multiple accounts on my android
device and...

-- ...I try to create a new contact in the contacts app.  What
happens?  The contacts app will ask me under which account the contact
should be created.

-- ...I try to view my contacts in the contacts app.  What happens?
Only the contacts who's accounts are configured to appear under
Contacts->[menu]->Display options will appear.

-- ...I try to add a contact programatically using the
ContactsContract API.  What happens?  This I'm not completely clear
on.  If you use the RAW_CONTACTS uris, I suppose you [must?] specify
the account type and name when you add the contact.  If you use the
CONTACTS uris, a raw contact gets created, but I don't know if the
account fields are populated.  You could try it and dump the db table.
 If you do this experiment, let me know the result!



Contacts FAQ?

by ydario » Sat, 12 Dec 2009 23:31:42 GMT

 Hi Brian,

unfortunately I don't have a 2.0 phone, and the emulator does not have
working authenticators.

yes, nice thought.

And while Contacts are not account aware, RawContacts are. Here it
comes to my mind the aggregation: can a contact aggregate raw accounts
from different types?




Contacts FAQ?

by sazilla » Tue, 15 Dec 2009 19:45:45 GMT

 Hi everyone,

I encountered an issue while configuring my own account for android
contacts sync. When the user choses to add a new contact to the custom
account, only the name fields and the photo are showed. This behaviour
can be found in the android source file.

My question is, if I don't want to add custom contacts fields for my
account, how can I configure the account to show all the standard
fields in the contacts application in the same way the google account

Thank you



Contacts FAQ?

by Jens » Tue, 12 Jan 2010 18:45:58 GMT

 You could check the Email app - its the current location of the
Exchange ActiveSync SyncAdapter implementation. ;a=summary

Note that this adapter isn't the complete story as any contacts you
create with your custom accounts will be next to useless without
looking into the wonky integration required for
custom adapters (unless your happy with contacts that only contains a
name and photo). ;a=tree;f=src/com/android/contacts/model;h=e58985879d5b88e3374b3fad847da3786e47ee94;hb=08d3445a85a65c56c0f09d24f871ffbd3b93187f contains the "super-special-let's-not-use-our-own-API:s-
anything-or-heaven-forbid-test-it" if-statement that determines the
layout of your contacts in the Contacts app - and gives super-special
treatment to accounts with the type "" or
"". contains the sparse and incomplete API
documentation that you're going to have to use.

> start a new project?

Contacts FAQ?

by Jens » Tue, 12 Jan 2010 22:54:55 GMT

 Developing in the SDK you can use the account type "" - this
will trick the Contacts app into displaying all the fields without
trying to use the broken contact field format Brian hinted at earlier
in this thread. This will of course probably not work in an actual
device where the "" authenticator is already added.


> Carlo

Contacts FAQ?

by Berto » Mon, 25 Jan 2010 07:48:05 GMT

 So, it turns out that anything you put into your own ExternalSource
will never get parsed and therefore (theoretically) never show up.  Or
am I doing something wrong?  The code looks like it will parse only
the information in ContactsDataKind and not the EditField node from
the following:

<ContactsSource xmlns:android=" 
        <EditField column="data1" title="@string/sample_string" />

Essentially, I have adding an account and the sync adapter working.
But when I try to create a new contact through the contacts app, I can
never see any of the fields I added in the XML structure defined by
"<meta-data android:name="android.provider.CONTACTS_STRUCTURE"
android:resource="@xml/contacts" />".  Has anyone figured out an
answer to this problem yet?  I've seen a few posts, but nothing with a
solid answer.


Contacts FAQ?

by Berto » Tue, 26 Jan 2010 00:25:44 GMT

 ust an update for those of you still lost on adding custom accounts,
sync adapters, etc. I found a great article here:

Part 2 was the part I needed (how to render the information you synced
to a contact).



On Jan 22, 4:57pm, Berto <> wrote:


Contacts FAQ?

by HCH » Wed, 03 Feb 2010 10:29:30 GMT

 hanks so much for the link and of course many thanks to the original
poster (Sam Steele). Anyone with android account and syncadapter
questions should read his posts.

My issue now is having the contacts app display and edit the standard
fields (the stuff that lives in CommonDataKinds). I believe it's a
matter of finding the SourceConstraints xml that is used for the null
account or perhaps recreating it by hand.

On Jan 25, 8:25am, Berto <> wrote:


Other Threads

1. getting my current location

I am trying to produce a mock location provider by using an example
kml file grabbed from somewhere (where I cannot remember now). Anyway
I think I also need a properties file but I'm not sure where this goes
and what it is called.

The code I am using is -

locationManager = (LocationManager)getSystemService
Location location = locationManager.getLastKnownLocation("gps");

double lat = location.getLatitude();
double lng = location.getLongitude();

It seems that I am not getting anything back from the kml file, but as
a beginner to Android and Java I am struggling to debug the problem. I
am using eclipse Ganymede.

What I need really is some pointers on the following:

1. How do I debug so that I can see the values of Location.getLatitude
() and location.getLongitude(); ?
2. I am referencing "gps" as my provider and have a kml file located
at C:\Program Files\android-sdk-windows-1.6_r1\tools\data\misc\location
\gps . Is this correct?
3. How do I create the properties file?
4. Any other advice would be greatly appreciated.

I have scoured the net for answers but nothing seems to fit what I am
after. I have also tried to go to URL
but it redirects me to

Thanks in advance,


2. How long is loooooonnnnggggggg

I've ran into the same problem with hello world.

How long is long.

I am at 2 minutes and counting.....

You can't be serious.

MSFT would never release a project like this.


3. need complied binary of android with bluez

4. How to add new MIME type?


6. Creating Activity From User Clicking Overlay

7. Android Virtual Device (AVD) and accelerometers