How to IMPORT CONTACTS and GPS location

hakan at exformedia.se hakan at exformedia.se
Fri Feb 22 05:14:31 EST 2019


Take a look at mobileFindContact, mobileGetContact etc (search for contact) in the dictionary… Remember though that you will get a dialog asking the user for permission and if they reject you will not be able to grab anything!

GPS is a system with satellites that your device can use to pin-point where it is on the globe (Global Positioning System), but I guess that you are asking for some geolocation based on an address. And yes you can do that via Google or any other provider of a map API. Do read the licensing careful as Google has limitations on how you can use the service and how much you need to pay (if you do a lot of lookups). To use The Google api you first need to get an API key. You then need to send that key together with every request:

https://maps.googleapis.com/maps/api/geocode/json?address=empire+state+building+new+york&key=YOUR_API_KEY

Another alternative is to use Open Street map. Take a look at:
https://wiki.openstreetmap.org/wiki/Nominatim

But if you are in a hurry the syntax is something like:
https://nominatim.openstreetmap.org/?format=json&addressdetails=1&q=empire+state+building+new+york&format=json&limit=1

So to use that in your LiveCode application you can do

function nomatimLookup pQuery
   put "https://nominatim.openstreetmap.org/?format=json&addressdetails=1&format=json&limit=1&q=" into tURL
   put textEncode(pQuery,"utf8") into pQuery
   replace space with "+" in pQuery
   put pQuery after tURL
   put url tURL into tResult
   return JSONToArray(tResult) // or jsonImport(tResult)
end nomatimLookup

This will return an array with data about the address and among those fields you find "lat" and "lon" for latitude and longitude if that was your GPS question...

But before you start using it, also take a look at the usage policy for the api: https://operations.osmfoundation.org/policies/nominatim/ and especially the requirements section!

There are a lot of other api providers that you can use also, depending on your need. But this will hopefully get you started...

Good Luck!

Håkan Liljegren
On 22 Feb 2019, 08:32 +0100, paolo mazza via use-livecode <use-livecode at lists.runrev.com>, wrote:
> Dear LiveCoders,
> I have not been using livecode for a while and do not know anymore
> what are the features of Livecode today.
> I would like to know
> - if LiveCode can IMPORT THE CONTACTS from the Iphone and Android systems
> - if it is possible to send an address to Google and get the GPS
> location from a LiveCode app.
> Best regards,
> Paolo Mazza
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list