addEventListener - location: Can it be done anytime?

I’m creating a navigation project where the user only needs location services at a certain point (think use app for planning route, then switch on location when starting journey).

Do I have to switch on runtime:addEventListener( “location”) at the start?

It looks like if I do it on a buttonpress, nothing happens. 

Can I detect that the listener is operational?

I would only add the listener when you need the information and remove it when you don’t. Just be aware that to get location data you will need to wait for the event to be fired. If the listener is not added your app will be consuming less system power because the GPS will not be on (unless something else is using it in the background, of course.) Most apps don’t need constant location data, so write a module which adds the listener and then removes it once it gets it’s first location event fired.

I would only add the listener when you need the information and remove it when you don’t. Just be aware that to get location data you will need to wait for the event to be fired. If the listener is not added your app will be consuming less system power because the GPS will not be on (unless something else is using it in the background, of course.) Most apps don’t need constant location data, so write a module which adds the listener and then removes it once it gets it’s first location event fired.