Reputation: 2367
How to get a users City and Country from an application in Android without GPS?
Upvotes: 4
Views: 8279
Reputation: 512
You can also use the IP address, there is some webservices which will give you the location of the caller : http://free-web-services.com/web-services/geo/ip-to-location/
Upvotes: 0
Reputation: 3905
another solution would be to use a web service that detects the user's location via IP address.
http://ipinfodb.com/ip_location_api_json.php
Upvotes: 0
Reputation: 7082
From a thread in the mailing list:
"If you try to get information to which MNC-MCC you are connected use the TelephonyManager.getNetworkOperator() API. The MCC (mobile country code) is the information you are looking for."
Apparently, the simplest of all getLocale().getDisplayCountry() doesn't works at all so, without the location API, this is all you can do (besides Wi-Fi location).
Upvotes: 2
Reputation: 80340
Get users location via LocationManager.NETWORK_PROVIDER
. Then use Geocoder to get address from location.
Upvotes: 0
Reputation: 3006
You can do it throug Cell tower or WiFi location. Or through PassiveLocation Provider. You can learn about it in this Google I/O video (min 20) http://developer.android.com/videos/index.html#v=twmuBbC_oB8
Upvotes: 3
Reputation: 20167
Pop up a dialog and ask them to enter a zip code?
Where else exactly would this "data" come from if not GPS?
Upvotes: -2