David Jones
Posts: 0
Joined: Wed May 06, 2015 7:46 pm

Geolocation coordinate update problem

I have created a very basic car tracking app using the geolocation service. The location refreshes every 30 seconds and sends the data to a 3rd party REST Service and stores the data in database. This all works ok.

The problem I am experiencing is that the long and lat coordinates don't always update on the geolocation service and I can drive for several miles before it registers a change in location. I have checked the phone has gps and data reception during these periods and can confirm that it does. I have tried several variations using both setinterval and settimeout calls to refresh the geolocation. I have also tried changing the settings on the geolocation such as enablehighaccuracy to true & false and nothing appears to make a difference. The application has not frozen as the REST service is still called and the data is added to the database.

As I am in the early stages of development I am running the app through the appery.io testing app on an iphone. Are there any known issues running geolocation through the testing platform?

If not are you aware of anybody else experiencing difficulties with the geolocation coordinates not reliably updating that may help me to figure out what the problem is.

Thanks in advance.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Geolocation coordinate update problem

Hello David,

Please change value of enableHighAccuracy and test your app again.

David Jones
Posts: 0
Joined: Wed May 06, 2015 7:46 pm

Geolocation coordinate update problem

Hi Sergiy

I've tried changing enableHighAccuracy, timeout and maximumAge to various values and nothing has any impact.

I have discovered through various searches that there was a problem with PhoneGap geolocation (which I believe appery use) on IOS 8. Do appery use the latest version of phonegap geolocation?

Thanks

David Jones
Posts: 0
Joined: Wed May 06, 2015 7:46 pm

Geolocation coordinate update problem

Hi Sergiy

I've completed some more testing with two separate devices (android & iphone) on the same routes, at the same time, and the results clearly show the problem relates to the iphone.

The geolocation is not reliably updating on IOS8. Do you have any thoughts or work rounds to get the phonegap geolocation working properly in appery on IOS8?

Thanks

Andy Jacobs
Posts: 0
Joined: Thu Apr 16, 2015 11:34 am

Geolocation coordinate update problem

Hi David

Which iPhone? I'm building an app that tracks long and lat as well. I've been testing it on an iPhone 5 (Not S or C, just the original) running iOS8. With the map displayed on the screen, it plots markers very, very quickly.

Regards
Andy

David Jones
Posts: 0
Joined: Wed May 06, 2015 7:46 pm

Geolocation coordinate update problem

Hi Andy

I've been testing on an iPhone 6 through the appery.io tester platform. It usually starts ok and tracks for a little while and then the location just freezes. It will then randomly start and stop throughout the journey. I call a REST service and import the details into a database at intervals of 20 secs which it does successfully so I know the application itself isn't freezing.

In contrast when I have tested on a galaxy S3 it is flawless and extremely reliable.

I had read that there were problems with phonegap on iOS8 so was trying to figure out if this maybe the route of the problem on the iPhone. However, if you are saying it is ok on your iPhone 5 running iOS8 I'm now wondering if it maybe iPhone 6 related.

How are you calling your geolocation service? I call mine through by setting a setinterval call within the screen load javascript.

Thanks
David

Andy Jacobs
Posts: 0
Joined: Thu Apr 16, 2015 11:34 am

Geolocation coordinate update problem

I started from here:

https://devcenter.appery.io/tutorials...

I removed all the buttons and just use the action from the 'Show My Position' button. I've then got a bit of Javascript that works out the distance to a set location and displays that constantly on the screen with the map. This is done on the Success trigger on the data page to run my Javascript for the calculations.

This is only my second app on Appery and only my 3rd or 4th full stop, and I'm not a coder so I'm learning Javascript at the same time. So, forgive me if I don't know all the techie bits!

I drove from the office to home the other night which is about an hour and a half. It was running for a lot of that but only as a web app where I just used the 'Add to home screen' function on the phone. It was running the whole time but not always in the foreground. The only effect this had was that the trail of markers on the map started again each time I switched back to the app by double tapping the home button.

I've got mine working so that it sends a text through Twilio once I hit a certain point on my journey home so my other half knows to get my dinner on :)

I can't help technically, but if you want me to test it on my iPhone 5 or anything just shout.

Cheers
Andy

RobertJay
Posts: 0
Joined: Fri Jun 15, 2012 1:32 pm

Geolocation coordinate update problem

Hi David,
I assume you're sure you're actjually using Phonegap, meaning you have a hybrid/native app and not a pure-web app which would use the browser's navigation. I ask, because I appear to have some mapping issues with my pure-web app with no Phonegap reliance.

Also, my issue may be with Safari specifically (particularly when the app is accessed via the home screen) and/or AT&T using either a 4G or LTE network.

I'm also new at this, so these thoughts may have no bearing on your situation. I'll be following this thread with interest. Good luck.

David Jones
Posts: 0
Joined: Wed May 06, 2015 7:46 pm

Geolocation coordinate update problem

Hi Sergiy

I've tried your suggestion and it makes no difference.

I've been testing different scenarios over the last few days and everything points to a problem with geolocation on the iOS platform.

iOS - Tested on Iphone 6 running iOS 8.3 & Ipad running iOS 6.1.3
1) I've tried changing enableHighAccuracy to false - makes no difference.
2) I've tried changing the timeout value - makes no difference
3) Ive tried changing maximumAge - makes no difference
4) 've tried removing the appery geolocation service and hard coding getcurrentlocation and storing the lat/long data in the local variables in a javascript call and this makes no difference.

ANDROID
1) The geolocation works brilliantly and exactly as expected.

As I previously explained I'm calling the geolocation service through a setInterval call that runs every 20 seconds and whilst locations are being stored to the database through a REST service every 20 seconds the actual location often doesn't get updated and can leave gaps of several miles in a journey plan.

I am sure that this is a problem with the appery tester program not refreshing correctly in iOS as when I test the android application I am actually running through a hotspot on my iPhone 6 which means the geolocation on the android will therefore get the location of the iphone 6 (i think this is correct?). So if the android is correctly getting the iphone6 location it can't be anything wrong with the GPS on the iphone6 and therefore points to the software not refreshing the variables correctly on the iOS versions of the appery tester.

The iOS tester does usually get the location correctly initially, however, once on the move changes in the long/lat locations kick in and out several times on a journey of approx 1 hour.

Please can someone from Appery advise or look into this problem and at least test an iphone geolocation service with a setinterval call through the appery tester.

I look forward to hearing from you.

Many Thanks

David

David Jones
Posts: 0
Joined: Wed May 06, 2015 7:46 pm

Geolocation coordinate update problem

Hi Robert

I've tried it both ways, using phonegap and also by removing it completely from the project and using getcurrentlocation through javascript calls. Both have the same incorrect and unreliable location problems. I've even tried clearing out the local variables on each call as thought that it may be these not being refreshed, but again no difference. I've put a lengthy reply to Appery staff (as you will see above) but in short the problem relates solely to iPhone as on Android everything works ok.

Interestingly I created a new project using the Appery backup project from this tutorial: https://blog.appery.io/2014/02/buildi...

This is Appery's code, with no adjustments from myself, so according to Appery should work with no problems... but exactly the same results. There is clearly something fundamentally wrong with either geolocation on the iPhone or using geolocation through the Appery tester platform on iOS. This is starting to drive me crazy!

Still waiting for a response from Appery on this as the answer given so far does not work.

Thanks
David

Return to “Issues”