Page 1 of 1

Geolocation not working since update?

Posted: Fri Aug 23, 2013 7:44 am
by Toblerone

I am having some problems with a geolocation service since yesterday's update. I've even created a brand new app, done nothing but add a map to the page, then a new geolocation service. Then I mapped lon/lat to the lon/lat of the map and invoked service in load, nothing else on page.

Whenever i test (tried tester + browser, which does pass location details as it used to work fine before yesterday) now it just shows

Cannot refresh, map is not initialized! this happens in appery.js:2241


Geolocation not working since update?

Posted: Fri Aug 23, 2013 9:21 am
by Kateryna Grynko

Hi Toby,

Geolocation service can only work on a real device or Android emulator. Its work in the device mobile tester depends on the device.

I don't know how this could affect update service, but work with Google Maps is always accompanied by the need to wait for the download. We usually use Page Show event and a timer delay:
codesetTimeout( function() {
// your code for google maps
}, 1000);/code


Geolocation not working since update?

Posted: Fri Aug 23, 2013 9:28 am
by Toblerone

Hi Katya,

This is simply not the case, geolocation works fine in browsers as they pass location data, this has been working fine for weeks up until yesterday's update and now it's stopped working. And yes, I've tried on tester too and get the error from a very simple test page.


Geolocation not working since update?

Posted: Fri Aug 23, 2013 9:54 am
by Toblerone

There is no code for google maps in a quick test, it's purely drag a map on, onload of page invoke geo service, and in that service map lon/lat to the long/lat of the map, nothing fancy, just a test that should, and did 100% used to work before update.


Geolocation not working since update?

Posted: Fri Aug 23, 2013 9:55 am
by Kateryna Grynko

Toby,

Please try using Page Show event and startup delay. Google Maps does not run instantly and does not report their ready status. On Load stage they are definitely not yet started. Depending on the connection speed they may still be uninitialized even on Page Show.


Geolocation not working since update?

Posted: Fri Aug 23, 2013 12:29 pm
by Toblerone

Katya,

I've even put the invoke service on a button on a page, so nothing happening in page load or page show, and still i get

Cannot refresh, map is not initialized! appery.js:2241

i even made a whole new product, dragged a map, dragged a button and created a geolocation service for this, nothing else. I put a console.log into the load and pagesohw events just so i could see it was actually running and that's it.

Try it yourself please

1.. Create new project
2.. open startscreen, drag a map component and a button
3.. create new geolocation service
4.. add instance of geolocation service to startscreen
5.. map lon/lat from service to lon/lat on map
6.. add invoke service to button click event

simple test, which should work and did before update, does not now. I know it's making the geolocation request to the browser as in ie i get the "Allow appery.io to use your location prompt" but that's as far as it gets. The map error happens before the request for geolocation so can only assume something in update broke the map component.

And no, it does not work in tester either :P


Geolocation not working since update?

Posted: Fri Aug 23, 2013 12:34 pm
by Kateryna Grynko

Did you try on device?


Geolocation not working since update?

Posted: Fri Aug 23, 2013 12:40 pm
by Toblerone

Yes Katya, as per my reply, i tried using the appery tester (on device). But again it used to work on browser just fine until your update yesterday, something has broken. Several other people I know are having same issue, this needs urgent attention please.


Geolocation not working since update?

Posted: Fri Aug 23, 2013 2:37 pm
by maxkatz

You also need to refresh the map once you have a new location: http://docs.appery.io/tutorials/build...


Geolocation not working since update?

Posted: Fri Aug 23, 2013 9:20 pm
by Toblerone

Hi Max,

Whilst true i'd missed the step out in my simple example above, in the first app I had it was in there already, however it's all working now, I can only assume I was having some network issues which was preventing some map component loading.

Thank you for your support.