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/
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
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 do apps like Fake Location spoof their location in a way that fools other apps like Google Maps, FourSquare and Facebook into thinking that this location is valid?
I have searched lots of similar questions and a lot of answers are around making your own mock location provider which I tried but Google Maps is still at the correct location not the fake.
To be clear I dont want my fake location provider inside of my main app, I want to be able to spoof the location to fool other apps that are not directly linked to believe this location is the valid one
This may be a kinda odd question but I am new at Android development and I'm having trouble to learn how to retrieve the user's location to my application. I have looked for this topic but I just can't find a statisfying answer.
To get the user location I have found two ways:
http://developer.android.com/training/location/retrieve-current.html . This one is using what I think is the new Google Services release which uses a LocationClient to connect to Google Services and retrieve the location.
http://developer.android.com/guide/topics/location/strategies.html . The other one is using the android.location class and a LocationManager to retrieve the location.
The thing is that I don't get the difference between using one way or the other, which one is better??
And another question is that in the second way you can specify which location provider you want to use, if the GPS provider or the Network provider and in the first one you can't, but in the first paragraph it says that it uses the location sensors that are currently active for the device. Does this mean that I don't have to worry about choosing between both services??
I am using Android Studio and I have set up the new Google Services release, I just need to know the pros and cons between both ways to know which one to use and to begin learning.
Thanks!!
As stated in the second link:
The Google Location Services API, part of Google Play Services, provides a more powerful, high-level framework that automatically handles location providers, user movement, and location accuracy. It also handles location update scheduling based on power consumption parameters you provide. In most cases, you'll get better battery performance, as well as more appropriate accuracy, by using the Location Services API.
I would highly recommend you to watch the last I/O video to get a simple explanation from Reto Meier about the new Location Provider: http://youtu.be/GcNNx2zdXN4?t=14m29s (I suggest you to watch the entire clip btw, it's inspiring).
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.