Location accuracy of Google Analytics for Android - android

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.

Related

current location on google maps without turning GPS on (android device)?

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.

Apple Maps and Google Maps API feasibility

I want to build an application where the user can see his current location, and all the users logged in to the app as well.
I want to build it for Android and IOS.
Can I use Apple Maps on IOS and Google Maps API on Android?
Will the application be able to show the current logged in users location on both IOS and Android with no problems? even though am using Apple maps on IOS and Google Maps API on Android?
To be more clear: the android user can also see the IOS users on the map and Vice-Versa
Or I have to use Google Maps API on IOS as well?
Its possible. Just you need to save the lat long on your server of every logged in user. And while any client i.e. Android or iOS app login the app you can have an endpoint that returns the location of all logged in users in server. For server component, you need to develop one endpoint to save the lat long and one endpoint to fetch all the lat long's saved on server.
Of course can. iOS and Android native components will return you same location (as much as possible apart) in spherical coordinate system, then you can do with this location what do you want.
Yes you can. The information is sent by the clients, on the server side you can manage/handle that information as you want/need ;)

Google distance matrix web service limit

According to this Google document there are limits on using Distance matrix web service.
From the document :
Use of the Distance Matrix API must relate to the display of information on a
Google Map.Use of the service in an application that doesn't display a Google map
is prohibited.
I am not clear whether I meet this limit or not.
Let me explain how I use this web service. I call this api from server to get distance between locations. Using this distance I just decide that user1's entered location is near to user2's entered location or not. I don't use this information to display on google map. But at client side I display google maps with marker for user's entered location and markers for nearby users' location.
Using web service and google maps this way, do I satisfy the above mentioned limit?
Note : I also call direction web service at client-side to display routes on map.
MAPS API
Your usage is fine. I think the whole point of the Google guidelines you quoted above are to stop people using the distance matrix and other Google Maps APIs (without a Google MAPS API business account) from using it outside of any "app" scope for financial gain or in situations where there is a simpler solution that doesn't require their API. (I will get to this soon)
This is also the reason they impose lower limits on the numbers of API calls you can make per day when using a free Google Maps key:
Normal - 2 500 elements per 24 hour period.
Business - 100 000 elements per 24 hour period.
I've used many of the Google maps API services on free accounts across a broad range of applications, some that match the scenario you have state above, others that do not. We have never had a problem at all and as long as people use the API fairly, they shouldn't either.
Other ways
There are other ways of doing what you require. You could calculate the distance between the two locations using the Haversine Foruma
http://en.wikipedia.org/wiki/Haversine_formula
and then send this distance down to your app upon request. This would remove the need for the Distance Matrix API in some circumstances (I'm unsure how indepth your App and Web Services actually are).
Why not instead use straight line distance between two points?
Try to find something similar to Android's Location.distanceBetween in the language you use for your server or just port the code from Android.

Using Google Maps location without Activity

I have a service which receives locations through registering a LocationManager.requestLocationUpdates.
But there have been some issues on some phones.
When battery runs low, the network location provider stops sending location fixes (this problem is addressed in this SO question). It's not a only a problem with my app but also the other apps just stop receiving locations.
Even when the phone is recharged the problem persists until the full reboot.
However, I found out (and someone also mentioned it in the SO question above) that Google Maps still keeps receiving location updates - when I open Google Maps app it shows the correct location and updates.
So I was thinking about a workaround of using locations from Google Maps API. I have absolutely no experience with the Maps API, but it seems that it needs a proper GUI (Activity) application to be used with. Or am I wrong? Is there a possibility to use Google Maps API to receive locations even within the Service?
Given some extensive testing from a reliable source, I believe that you might want to consider using the FusedLocationProvider supplied with Google Play Services. It seems to take the headache out of choosing the appropriate power criteria and so on.
Be aware that this will require that the user must have Google Play installed on their device, so Kindles and the like will be out of the picture. It also requires a minimum of Android 2.2.
Some more information about the location services provided by Google Play Services can be found here.

How does google maps get location on android device?

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/

Categories

Resources