Android Question Contact's "Job Title"

ddahan

Member
Licensed User
Longtime User
Hi,
Is there any way to get Contact's "Job Title: Field. I cannot find any reference for that.

Thanks,
David.
 

DonManfred

Expert
Licensed User
Longtime User
You talk about the contacts you can change at google contacts, right? to change this contacts you have to Auth your app to google and then using the Google contacts API.
 
Upvote 0

ddahan

Member
Licensed User
Longtime User
Thanks for replying.
I just want access to the internal contacts. Contacts2, fgContacts, ContactUtils and other libraries have fields like "Display Name", "Company", "Phones" ... but I cannot find any reference to the "Job Title" field.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Look here please. There is an example which reads the google contacts i´m talking about.
In that example only the "Names" of the contacts are read...
But the google-contacts have more than only names and telephonenumbers.

On googles contacts-website you can add a reference to "Job Title" and more

you there can create your own vars too. Like a pet for example
from google contacts api:
<gd:extendedProperty name='pet1' value='Cat'/>
<gd:extendedProperty name='petname1' value='Zora'/>
<gd:extendedProperty name='pet2' value='Cat'/>
<gd:extendedProperty name='petname2' value='Charly'/>
<gd:extendedProperty name='pet3' value='Cat'/>
<gd:extendedProperty name='petname3' value='Lucky'/>

or

<gd:extendedProperty name='SexualPreference' value='69'/>

:D

Erels example works fine. BUT it only reads contacts actually... You should easy be able to read the extended property JobTitle when you extends the example (reading the XML and parsing with sax xml parser)

I´m sure it´s THAT you are searching for!?
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Hi,
Is there any way to get Contact's "Job Title: Field. I cannot find any reference for that.

Thanks,
David.
Yes. Add the following Type to ContactsUtils:
B4X:
Type cuOrganization(Company As String, Title As String)
Add this sub:
B4X:
Public Sub GetOrganization(Id As Long) As cuOrganization
   Dim organizations As List = GetData("vnd.android.cursor.item/organization", Array As String("data1", "data4"), _
     Id, Null)
   Dim o As cuOrganization
   If organizations.Size > 0 Then
     o.Initialize
     Dim obj() As Object = organizations.Get(0)
     o.Company = obj(0)
     o.Title = obj(1)
   End If
   Return o
End Sub
 
Upvote 0
Top