This topic is not a problem. It is a solution for using geolocation.
I used the Cordova plug-in for geolocation in my app. Sinecure a couple of days getCurrentLocation does’t work anymore. I read from Cordova that their plugin is deprecated. I removed the plugin and changed my code to use Web Geolocation. Now my works fine as before.
Where did you see this? I’ve been using it fine. Instead of getCurrentLocation, I’m using watchPosition and seems to be working fine.
I don’t see anywhere on their documentation that it has been depreciated. I’d love to know what the case is since I’m working on an app that rely’s on geolocation.
I try to develop an Ionic app with android platform using ngCordova geolocation. I just want to get the user location (latitude and longitude). So a simple geolocation Ionic app based on the Ionic seed tabs app ! But, it doesn’t work.
Of course, I’ve installed
the JAVA SDK,
ant,
Android SDK for Eclipse,
Ionic,
cordova
and then initial Ionic tabs app worked fine. So, I’ve install ngCordova with bower and I had some line of Javascript in order to get the location of the user
In my index.html file, I’ve had a reference to lib/ngCordova/dist/ng-cordova.js before cordova.js,
In my controller, in the $ionicPlatform.ready function, I call a own service which call $cordovaGeolocation.getCurrentPosition in order to get the position
But, when I emulate the app with ionic emulate android I’ve got a black screen in then android emulator.
How can I debug this please. I’ve no information from android emulator, event if i use $log.debug or console. What is the best way to debug an ionic app for android platform ? You know what I mean a way with a debugger, with breakpoints, … Is there a solution to do this ?
I simple use: window.navigator.geolocation.getCurrentPosition(function (location) in a function.
So ngCordova uses the same.
In my opinion this has nothing to do with end up your app in a black screen.
You can sent your code to me. I’ll try to make it working.
By the way: the best way to debug an Android app is using a real device connected to your desktop. If you use a device with Android 4.4.2 you even can use webdevtools in chrome to debug like you do in chrome.
After 3 years developing apps I learned its hard (almost impossible) to debug without a real device.
An alternative way to debug is to use hte “ionic serve” command with Firefox and to install the Geolocater plugin. With Geolocater, you can define several geographical points, select one of them and retrieve the selected geographic point in your app.
@pcr Hey, just looking at the post, you seem pretty experienced with the $cordovaGeolocation plugin. If you get a chance would you be able to take a quick look at this? Cordova, $geolocation and geocoding in Ionic
Now I remember why I use still navigator.geolocation.watchposition instead of ngCordova. Because the navigator option also workshop in a browser. NgCordova doesn’t work in the browser. I hope the ngCordova team soon will bring good working mocks with good instructies how to test/develop ngCordova functions in a browser, because developers used to develop with a desktop browser.
Hi, geolocation is working here (ios with ionic and ngcordova) but what about user permissions? If the user says no to the first alert (“would you like to allow access the geolocation…” ) , how can I request again the permissions?
If you’re working on a mobile application using Cordova 4.0 + and you’re using Google Maps do not forget to install Cordova Whitelist plugin. As of Cordova 4.0 all external resources permissions can be done only through this plugin, which includesGoogle Maps.
@folador Best practice: Before popping the system modal requesting permission, present another modal with messaging about why you’re asking for permission to access location (e.g. “We can only show you the best deals if we have your current location”). That modal should also have options “Cancel” or “I agree”. Then, if the user taps “I agree”, then show them the system modal asking for location and they can once again tap “Yes”.
is it possible to include in a form/field the lon/lat next to the address on an ordering form ?
would make it easier for delivery as then the driver app gets the lon/lat instead of the whole address from the backend using FCM push