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
mentioned.



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/
ExternalSource.java reveals that the EditField and EditTypes info in
the
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 ExternalSource.java?

Thanks,
Brian



> 



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"
                        android:name=".gbService">
                        <intent-filter>
                        <action android:name="android.content.SyncAdapter"/>
                        </intent-filter>
                        <meta-data android:name="android.content.SyncAdapter"

android:resource="@xml/syncadapter_description"/>
                        <meta-data
android:name="android.provider.CONTACTS_STRUCTURE"
                                android:resource="@xml/contacts" />
                </service>

See the (limited) sync adapter documentation for details on preparing
res/xml/syncadapter_description.xml.

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.

Ciao,
Brian

--



Contacts FAQ?

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


 Hi,



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
authenticator.

I tried adding contacts code to this project

 http://code.google.com/p/androidaccounts/ 

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).

ciao,

Yuri

--



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.

Ciao,
Brian

--



Contacts FAQ?

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


 Hi,



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
contacts.

What is your experience regard this?

ciao,

Yuri

--



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!

Ciao,
Brian

--



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?

ciao,

Yuri

--



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 ExternalSource.java 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
does?

Thank you

Carlo

--



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.

 http://android.git.kernel.org/?p=platform/packages/apps/Email.git ;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 ExternalSource.java integration required for
custom adapters (unless your happy with contacts that only contains a
name and photo).

 http://android.git.kernel.org/?p=platform/packages/apps/Contacts.git ;a=tree;f=src/com/android/contacts/model;h=e58985879d5b88e3374b3fad847da3786e47ee94;hb=08d3445a85a65c56c0f09d24f871ffbd3b93187f

Sources.java contains the "super-special-let's-not-use-our-own-API:s-
because-that's-hard-work-and-might-require-us-to-actually-document-
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 "com.google" or
"com.android.exchange".

ExternalSource.java 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 "com.google" - 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 "com.google" authenticator is already added.

br
Jens



> 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=" http://schemas.android.com/apk/res/ 
android">
    <ContactsDataKind
        android:mimeType="com.example.mimetype"
        android:icon="@drawable/icon"
        android:summaryColumn="data2"
        android:detailColumn="data3">
        <EditField column="data1" title="@string/sample_string" />
    </ContactsDataKind>
</ContactsSource>

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:

http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1/
http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-2/

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

HTH,

Berto

On Jan 22, 4:57pm, Berto <mstbe...@gmail.com> 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 <mstbe...@gmail.com> wrote:

--



Other Threads

1. Store information in android setting menu

Hi,
I am creating an application that requires some values of username
during execution. Hence, I want to create an option for storing
information. I donot want to use the general java.io  classes for
storing information.

I want to create an option  "MyAppInfo" in the android setting menu .
When I click on this option, a next intent should open that displays
the values of  username.

How to create this type of application.  Is it possible??

If it is possible, then how can I read the information saved in the
setting under MyAppInfo ?


If the above mentioned is not possible then how can I use the java.io
classes to save the username, that can also be seen using the android
menu.  I have used the java OutputStream to write username to a file,
but I cannot see where it is. I can get its absolute path using the
getDirPath command, but how to see the loc

Thanks,
Nishant Kumar

-- 

2. Upgrade AmonRa di Dream [WTA] Cara update Recovery ROM

via terminal aja, simple kow....taro .zip nya, trus buka terminal
ketik :  #flash_image recovery /sdcard/recovery-RA-dream-v1.7.0.img





> Join:

3. Android Calender API

4. Slovak currency - Euro

5. how to filter objects from displaying them on the map

6. where the device "/dev/graphic/fb0" or "/dev/fb0" created in the kernel code?

7. How to send a json object to a server via android