Ok so I know that this function is in the library, but I have not found many examples online so thought we could share some knowledge on this function.
So far I can get the "mobileGetContactData" function to return the first name of the contacts using the script below. However, I have not succeeded in getting phone numbers, emails, etc.
Is anyone familiar with this function and know how to get the other data from the phone's internal contact database?
on retrieveContacts
lock screen
## This is just a small sample so it doesn't take too long
repeat with x = 100 to 125
put mobileGetContactData(x) into theData[Contact]
put theData[contact]["firstname"] into tContact
put tContact & cr after field "contacts" of me
end repeat
unlock screen
end retrieveContacts
As mobileGetContactData puts all data relating to a specific contact into an array it should be possible to use the combine command to return this data as a list.
The following example should help with getting you started
on mouseUp
repeat with x = 1 to 10
put mobileGetContactData(x) into theData
combine theData with space
put theData& cr after field "contacts"
end repeat
end mouseUp
So I tried the handler that you posted and I am still faced with the same issue. The only data that is put into field "contacts" is the first name. I know by looking in my contact list that the contacts listed have at least phone numbers as well. So I am still perplexed as to how to get phone numbers and other such data to appear.I also noticed that for an address book of 1000 contacts, this handler will take an extremely long amount of time, even with locking the screen.
I just downloaded the app "Viber" which in half a second after install had all my contacts listed with their phone numbers already compared to the Viber database in their app. I am really curious to how I can create something like that.
Any help with this or insights would be much appreciated. Thanks.
So I have tried calling "LastName", "Phone", "Email" and so on and so forth and none of them respond a value. given most of them do not have emails, but i sample 100 contact ID's when testing. about 20 to 30 show up in the range. All of them with phone numbers. The only thing that came up was a really weird facebook id marker from a previous phone on 2 of the contacts???
So I still don't get how to use it. Should I email Neil again?
The code I provided will should provide data in regards to the array that is created. My initial tests on iOS returned my contacts data, but this seems to not work as expected on iOS.
I have spoken to Hanson from our Quality Control Team regarding this and he has mentioned that using the combine command does not offer this kind of processing and returns the "empty" string if nested data is found. This should explain why it was not working.
More information on this can be found on the bug report here-
Hanson has also provided a more advanced stack that should be able to assist with extracting the specific contact data that you need. I have attached that stack to this reply.
On my Android 2.3 I'm not seeing sequential ID's, they go from 75 to somewhere in the 4000 range (I don't have that many contacts). Not saying this is wrong, just pointing out that "if it is empty then next repeat" should be taken into account.
Thanks for the stack, it does show some info which will allow me to better take the problems apart.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
runrevneil wrote: Hanson has also provided a more advanced stack that should be able to assist with extracting the specific contact data that you need. I have attached that stack to this reply.
The example stack doesn't seem to work at all. The display button returns nothing into the field - the retrieve button seems to put something (empty lines, perhaps?) into the field...but it isn't the contact details text
Gerry
14" MacBook Pro
Former LiveCode developer.
Now recovering.
repeat for each item tContact in tContactIds
add 1 to N
put tContact & cr after field "contacts"
put mobileGetContactData(tContact) into theData
put displayArrayData (theData, "") & cr after field "contacts"
if N = 5 then exit repeat
end repeat
that counter just so I could see the first few.
That showed me that
repeat for each item tContact in tContactIds
put tContact & cr after field "contacts"
-- put mobileGetContactData(tContact) into theData
--put displayArrayData (theData, "") & cr after field "contacts"
end repeat
Which told me I didn't have sequential ID's.
Oh, I also set the field text color to black because I did see the empty field, don't know if that was necessary.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!