1 2 Previous Next 15 Replies Latest reply on Oct 12, 2016 9:45 AM by sfpx

    Location updates


      We currently use a web object that contains some javascript code that constantly checks the location in the background and sends the data back to filemaker go (or FIAS) via the url scheme. See this old thread for more info on the script FMGO 13 , webviewer crashes  (it randomly crashed before IOS 9 but it now works fine)


      On the first use we'll get 2 authorization requests to access the location.

      One for FMGO/FIAS and the other for the actual script.

      After that, users will be asked for the authorization (from the script) every 24 hours.


      Not only that, the script request looks unprofessional

      It looks like this

      "/" Would Like to use your current location



      I haven't found a way to either modify the "/" in the authorization or to eliminate the daily request completely.


      Maybe the solution would be to create a module/library in xcode that would take the location in the background and send the info to the bundled sdk database via the url scheme (database is on the device not online). I'm not sure if it's actually possible and how to get started with that option though.


      Or maybe there is a way to modify the javascript to get a better authorization request.


      Anyway I would appreciate any suggestion to improve the current system.

      It works well but those incessant requests are annoying.

        • 1. Re: Location updates

          Have you tried the Location function yet?

          • 2. Re: Location updates

            I need to track location changes in real time. The location function as it is right now is unusable for that as it can not run in the background and will lock the interface while searching. I tried the function in an ontimer script but since it's not running in a different thread it locks the interface constantly. The javascript runs in the background. Plus it can display more information, like the speed, for example.

            • 3. Re: Location updates

              I see what you mean with the real-time changes. I don't know of a way around the dual authorization issue for that.


              Regarding the additional information, I'm not so sure you really can get more information from JavaScript running in a Web Viewer than with the LocationValues function. The HTML location API includes a quantity for speed, but that doesn't mean the iOS Safari implementation of the API actually returns useful information for it; last time I worked on it, there was technically a speed result, but I didn't get real data if the device was moving when I got the location. I'd be interested to hear if that has changed.

              • 4. Re: Location updates

                Here is document for setting on Safari,

                About Location Services in OS X and Safari - Apple Support

                does this effect to web viewer? (Set it "Deny" make your javascript stop working?)

                • 5. Re: Location updates

                  We  use the speed to detect movements/stops. It does the job.

                  • 6. Re: Location updates

                    Those are OSX settings. These settings are not on IOS.


                    Not sure which Prompt option is the default one on IOS .

                    I think that for Safari it's the  "one time only" option but in the case of the web viewer it's clearly the "each day" option.


                    The main problem may simply be that IOS can not identify the website of the web viewer (the "/" Would Like to use your current location prompt seems to indicate that) therefore can not save any setting.

                    • 7. Re: Location updates

                      Thanks, so it seems difficult to hack about setting files.


                      Did you try using file: on web viewer?

                      • 8. Re: Location updates

                        Thanks for the ideas.

                        I tested it with a file and the prompt displays the full path of the file which looks even worse then just "/".

                        I haven't tested if the setting is saved though.

                        I will retest it in 24 hours to see if I get the prompt again.

                        • 9. Re: Location updates

                          It did not work. The prompt appeared again today.


                          From a search on the web, PhoneGap had a similar issue with the location prompt.

                          Some Links:


                          ios geolocation prompt



                          Maybe the solution would be to adapt the Cordova javascripts to make it work inside a filemaker web viewer but that does not look like an easy task.

                          • 10. Re: Location updates

                            This still is a problem with my solution.

                            The daily authorization requests may be annoying but what's more problematic is that the script will stop once the authorization has expired.



                            Sept 4: Script Loaded at 7:00 am (auth. requests are displayed)

                            Sept 5: Script loaded at 6:00 am (no auth. requests displayed)

                            Sept 5: Script is running fine 6:00 -- 6:59 am

                            Sept 5: Script stops after 7:00 am because the auth. expired


                            Basically, as annoying as the auth. requests are I would still prefer to at least force them if the day has changed since the last request.


                            Any way to force the auth. request ? Maybe by clearing some cache or with a javascript command ?



                            There is forum member who's working on a FIAS framework. It's promising but so far it's not ready and meanwhile my users still need a working solution.

                            • 11. Re: Location updates

                              It seems that this script no longer works in FilemakerGo 15 .


                              Any idea ?

                              It works fine on Filemaker Go 14



                              "data:text/html," & "<!DOCTYPE HTML>



                                      <script type=\"text/javascript\">

                                     var Calls=0;

                                     var LastCall=0;

                                          function handler(location) {

                                              var messageArea = document.getElementById(\"messageArea\");

                                              messageArea.innerHTML=\"Calls:\"+Calls+\"<p>Latitude: \" + location.coords.latitude + \"</p>\";

                                              messageArea.innerHTML+=\"<p>Longitude: \" + location.coords.longitude + \"</p>\";

                                              messageArea.innerHTML+=\"<p>Accuracy: \" + location.coords.accuracy + \"</p>\";

                                              messageArea.innerHTML+=\"<p>Speed: \" + location.coords.speed+ \"</p>\";

                                              messageArea.innerHTML+=\"<p>T: \" + location.timestamp+ \"</p>\";



                              if (location.timestamp-LastCall>5000 || LastCall==0){














                                          function fail() {

                                              var messageArea = document.getElementById(\"messageArea\");

                                              messageArea.innerHTML=\"<p>Can't get located</p>\";






                                         function CallFM(latitude,longitude,accuracy,speed) {

                              var body = document.getElementsByTagName(\"body\")[0];

                              var a = document.createElement(\"a\");

                              a.href = \"FMP://~/MyApp.fmp12?&Script=UpdateCoords&$latitude=\"+latitude+\"&$longitude=\"+longitude+\"&$accuracy=\"+accuracy+\"&$speed=\"+speed;



                              a.style.display = \"none\";





                                          function getLocation() {



                                            navigator.geolocation.watchPosition(handler,fail,{maximumAge: 2000, enableHighAccuracy: true, timeout: 2000});







                                  <body onload=\"getLocation();\" bgcolor=black >

                                      <div id=\"messageArea\">








                              • 12. Re: Location updates


                                Substitute ( url ; "~" ; "%7E" )

                                • 14. Re: Location updates
                                  1 of 1 people found this helpful
                                  1 2 Previous Next