Code pen geolocation not work in a real device


I have try the codePen

and it work fine into the browser; but i want to test it into a device and this not work;
I have installed the cordova geolocation plugin
This is the plugin list in my project

cordova plugin ls
[ ‘org.apache.cordova.console’,
‘org.apache.cordova.geolocation’ ]

After i have build the project

ionic build android

In the ADT i have run the application into a device GenyMotion
All work but not the Find Me button: the $ionicLoading is freezed on the monitor of device as you see in the screenshot at this URL

What i have broken? :frowning:

Thank you


Did you debug your code?

Set a breakpoint in your error case and in your success case.

Maybe the plugin can not get your position and you do not hide the loading indicator in that case.

Greets, bengtler


Did you use emulator?
maybe you need to manually send the gps location to your device.

var options = { timeout: 30000, enableHighAccuracy: true, maximumAge: 10000 };

try add option and check that you’ve manually send location with your GPS widget.
And if you copy all of example index.html you need to add <script src="cordova.js"></script>


This work

Thank you very much


Glad I was able to help. :smile:


can you please tell how to insert this code and where.? I’m having a similar problem where i’m unale to see the map or android device but its working on browser


Find more about this problem here: