Is it possible for google maps to show my approximate location on maps without turning GPS on on my device? I understand it can not be very accurate but I am fine with that (even if shows location within a radios of 2km). I am having version 9.72.2 of google maps on my android device.
Thanks
Yes, if you have Internet access, it's possible via Google Maps Geolocation API and information about nearest mobile operator cell or/and wifi access points
You need send requests like:
https://www.googleapis.com/geolocation/v1/geolocate?key=YOUR_API_KEY
with information about target Cell Tower (how to get LAC and CID you can find here) or WiFi access point in request, and if target WiFi access point is in Google database your got response JSON with Lat/Lon and accuracy.
NB! But sometimes it returns completely wrong results.
For show current position you need to disable "standard" MyLocation tool
googleMap.setMyLocationEnabled(false);
and use custom, like described here.
Related
Actually I have lots of questions. I am developing a GPS device which gets the longitude and latitude location coordinates. Do I need any internet module? Can I use the device without any internet connection? Also, is it possible to get the coordinates and display it on my Application via Google Maps? Thank you for the help.
If you use the device's embedded GPS, you can get the longitude and latitude with no problem, without having any Internet access.
You can then use those coordinates however you'd like, so yes on Google Maps for example. Nevertheless, if you plan to use a Google Maps online API (for instance, the JavaScript API) you'll need an Internet connection to download and display the map. But there should be a way to use pre-downloaded maps offline, you will surely find it in the Google Maps API reference : https://developers.google.com/maps/documentation/
You can also take a look at some other mapping service providers (OpenStreetMap is one of the most used in replacement of Google Maps).
Sorry for not bringing a very precise answer concerning offline maps, but I hope this will help you with your issue :)
EDIT
It appears that it isn't possible to legally use the Google Maps API without an Internet Connection, according to Google Maps' Terms of Service
When testing Google Analytics (version 2) for an Android project, I noticed that the Real Time map shows my location to be about 200 miles from my actual location. I'm running my project on a physical device, which leads me to believe that Google Analytics doesn't actually send any location information, but rather gets it from the phones IP address when the data is sent to Googles server. Is there any way to alter this behavior and provide my own location data using getLastKnownLocation() for example? Sending it as an actual Label/Action string would of course work, but that means I can't use Google Analytics fancy map feature to view where my users are coming from.
You can't customize how Google gets the location data (which is by IP mapped location), however you can store custom dimensions and metrics: https://developers.google.com/analytics/devguides/collection/android/v3/customdimsmets
Google Analytics isn't really intended for fine grain location tracking. A good and free platform for location tracking is Cintric https://cintric.com/ which will track very precise locations.
Its a drop in SDK like google analytics. You then get access to a dashboard with all your users locations a a bunch of analytics / visualizations. It supports both android and iOS.
I am an android developer and have been using it for a while to develop context-aware apps. Location is one of the most important thing for context aware and accuracy of that location is very important.
I know how to get location from GPS using LocationManager... I know how to develop apps using Google maps on android... and also how to display user on the map.. etc. But my friends have found out that when they went to a foreign country for a conference, their location from LocationManager is very inaccurate compare to google maps.
They used my app (not released yet.. ) which I get my location from LocationManager and I registered for GPS and Network provider. If I plot the location that the phone gives me on a map... it's very inaccurate... some times it thinks the user is in Barcelona even though they are at a conference in USA.
Also since the conference was indoor, the GPS wouldn't have helped a lot because it would've had hard time finding a fix.
Does google maps on android get their location similar to how google tells the android developers to get the location... from LocationManager and register for onLocationChanged location listener? If it does... how come theirs is more accurate... how do they filter any outliers? or are they using any internal services to get even more accurate location which maybe google assume that if the developer get that accurate location they could misuse it?
Any ideas or comments??
This code is written by Reto Meier, Tech Lead for Android Developer Relations, who wrote the book on Android App development. Also, that was published in Google IO conference in 2011 as I remember. This is the closest to what is used in Google Places. And it works smart anyway ;)
https://code.google.com/p/android-protips-location/
My problem is the same with
cannot get place from google map using location
I installed a new android ROM and tested locationlistener with network location provider, nothing would return back.
But if I install Google Map from Market, and position myself in Google Map by network, it can locate me, and after that, I can locate myself in my app also. It looks like to install Google Market is a must for network locating.
Correct me if I am wrong. Is that true?
No, Google Maps has nothing to do with your network location.
If you enable (on your device settings) and set (in your code) that provider in your app then you can use it too. LocationManager.NETWORK_PROVIDER is what I'm talking about. Read more on the link below.
http://developer.android.com/reference/android/location/LocationManager.html
I have developed an application for my company to track the work done by our agency people and also their location to capture the work places. As we don't want the agency people to browse other website, with the help of network providers we have restricted other websites and allowed only two URL where we run the webservice to store the information captured to the database. But since Android talks to google to get the location we also need map the maps.googleapis.com but when we tried it's not working. Can anyone tell me which URL we should map/whitelist to allow my application to access the google. Thanks
i would think u would get coordinates regardless of internet connectivity. of course i could be wrong. are you sure you added permissions for location services in the manifest. i know i have tested gps apps without internet enabled (emulator though). of course the map wont load but coords should be able to be read from the gps receiver.
If you're talking about getting your current location, then you should use LocationManager(search on SO or google, there are lots of posts about it). Otherweise you can take a look at the Developer Guide for Google Maps, but I'm not sure if Android even uses the same API, though.
Or you can only retrieve the coordinates from the devices to your database/server and you'll have the map and with the coordinates you'll know where are they. That would not need a map in the application, and no need for whitelisting the urls. This is another idea, though.