1. Are you ready for the Galaxy S20? Here is everything we know so far!

Accessing phone GPS coordinates

Discussion in 'Android Development' started by Sinnie, Aug 31, 2021.

  1. Sinnie

    Sinnie Lurker
    Thread Starter

    Hey all,

    I've tried searching around the web on this topic a bit and can't find any definitive answers.

    I am looking at building an app which utilises the users location, and most websites I find refer to using geolocation APIs (specifically, Google's: https://developers.google.com/maps/documentation/geolocation/overview).

    The pricing for the API seems quite steep, if you have a use case which sees high frequency of use per user. If only 10,000 people make 200 location requests per day, that's $240,000 per month (on the $4 model, which would be lower due to the volumes).

    If you wanted an app that provided reasonable accuracy as someone travelled around (such as route tracking for getting across a city), isn't that a huge number of requests to the API? I know there's things to be done to rate limit the number of requests, but still, it seems like you could be left with a huge bill.

    I'm sure I'm missing something here, so would be grateful for any information with regard to how best to integrate high volume, regular, location checks without bankrupting yourself!

    My understanding is that the phone itself communicates with the GPS satellites and therefore stores the coordinates in the phone. Is that correct? Is it necessary to use a location API if I just want to use the GPS coordinates? I don't need Google maps, or any other service. I literally just want the longtitude and latitude of the phone at any given moment.
     



    1. Download the Forums for Android™ app!


      Download

       
  2. codesplice

    codesplice Elite Recognized Moderator
    Moderator

    You should be able to access the phone's location by querying the fused location provider directly on-device. You shouldn't need to run a bunch of queries against a costly web API. (I think; I'm not actually a developer, but I wasn't able to find any sort of pricing or limitations on using the on-device resources.)

    https://developer.android.com/training/location/retrieve-current
     
    ocnbrze likes this.
  3. Sinnie

    Sinnie Lurker
    Thread Starter

    Looks perfect. Thanks very much!
     
    codesplice likes this.
Loading...

Share This Page

Loading...