ffwdme / ffwdme.js

[DEPRECATED!] 🛑 A JavaScript toolkit that aims to bring interactive GPS driving directions to the mobile browser
http://ffwdmejs.org
MIT License
153 stars 36 forks source link

Checking if GPS is enable.... #9

Closed Neoespecialistas closed 9 years ago

Neoespecialistas commented 9 years ago

Hi,

I'm trying to check if GPS is enable. I tryed this code:


function init(){ ffwdme.initialize({}); });

ffwdme.on('geoposition:error', function() { alert('Please, put GPS active'); });

etc...


But never alert me that GPS is disabled.

What is wrong ?

Thanks in advance, David

fabrik42 commented 9 years ago

You should try to register the geoposition:error event before initializing ffwdme.

function init(){
  ffwdme.on('geoposition:error', function() {
    alert('Please, put GPS active');
  });
  ffwdme.initialize({});
});

Compare: https://github.com/ffwdme/ffwdme.js/blob/master/static/demo/app.js#L3-L18

Neoespecialistas commented 9 years ago

Thanks a bunch ! David