Good day!
And how do you determine the location of the user?
After long torment in finding ways to determine the location for "one-time" use, I decided to contact you, dear experts! The fact is that I support the project for a long time, and there were about three ways to determine the location.

  • The first method was about the same as in this example with the brute force of providers, but there were devices on which it did not work, or worked through time.

  • The second method was a modification of the first one, but using the background flow, which informed about this when finding the location, the method turned out to be better than the first one in all directions, but looked for a better position, i.e. It worked so where it did not work. But again, there were devices where this was not enough

  • Here is the third way it seemed to be one hundred percent, since it was based on Google maps, which, it seems, should determine the location whenever possible. An instance of MapView was created that never showed up, MyLocationOverlay was created to show the user, and he informed us about the current location. But today I ran into a device where it didn’t work, but because I used the empty string as a key when creating the MapView. But now it’s impossible to create a key for old versions of maps.

Of course, you can go back to sleep and use new maps instead of old ones, but there are users who cannot use new maps, and one of the main features of the application is tied to the location.


So, what method of positioning do you use and how do you struggle with the problem, that there are devices where it does not work? I would be glad to see as answers examples how it works for you.

UPD: I am familiar with this article , but having collected an example and starting at myself was surprised how much gluttonous this battery was, it made a modification, but nothing helped
UPD_2: by location uncertainty, I mean either the absence of one, or its incorrect finding, because sometimes results came 5 minutes ago, and taking into account the movement it plays its role

UPD_3: Due to the large number of views of the issue, I decided to write a solution to the problem: how I found the solution - described in the article

  • 2
    Creating a separate map in memory is certainly a masterpiece. The work of Hindu thought. In general, there are many situations where the coordinates can not be determined. For example, the phone is in the room. - KoVadim
  • Yes, I myself am not happy, but when you poke blindly for several months, not being able to debug on the device, receiving only an answer from people that the location was not determined, you no longer know what to do. However, why, when a user opens any map, whether it be standard Google maps, Yandex, 2gs or something else, is the location determined? What is the difference? What would you do? - andreich
  • Watch this video. There, the android developers tell how they are suffering in order to get good coordinates. There are tips on how to use it all. - KoVadim
  • Thank you for the video, but the fact is that there they are fighting over accuracy, but I need to get at least :) - andreich

1 answer 1

And how do you determine the location of the user?

The easiest way is to ask the user to turn on the GPS.

  • I disagree with you. GPS gives the slowest determination of location, and given that the user can actually be in the room, this will either slow down the search or not find it at all. - andreich
  • Geolocation over IP will not work? I just did not understand for what purposes you need to determine someone's location. - Developer
  • uh, did you write programs for android? it just seems to me that you don't quite understand what this is about :) and no, geolocation over IP will not work - andreich
  • 2
    Write an alternative client for geocaching.com? Joke. The solution depends on the size of the objects. If these are cities, then by IP, if restaurants and shops, you cannot do without GPS. - Developer
  • 2
    you can do without gps, launch any map without GPS on your android, your location will be determined with an error of 50 meters, and if you are not in the building and even less - andreich

Protected by a member Nick Volynkin ♦ Jan 18 '16 at 5:11 .

Thank you for your interest in this issue. Since he collected a large number of low-quality and spam responses, which had to be deleted, now it’s necessary to have 10 reputation points on the site (the bonus for account association is not counted ).

Maybe you want to answer one of the unanswered questions ?