Get the user's approximate location without GPS / WiFi / Internet - android

I'm trying to find a way of checking if the user is in the US, and do it somehow that it's instant. This means no GPS, and no internet.
I have a few ideas, but they're not as accurate as I'd want, so maybe someone here has some tricks up his/her sleeves.
Thanks!

I've just been looking at http://developer.android.com/guide/topics/resources/providing-resources.html and on table 2 there's some resource qualifiers for 'MCC and MNC' and 'Language and region'.
What about defining some resource, say a string indicating the country code, then setting up a different one for each country you are interested in.
You could then look at the string to see what country you are in. I guess you'd need a bit of experimentation to see what works best, but it might work :-)

Related

How to get exact location inside building?

Is there any workaround get exact location inside building or still it's not possible..
I've checked few things like
https://developer.foursquare.com/docs/venues/venues
http://www.walkbase.com/
http://www.directionsmag.com/articles/10-things-you-need-to-know-about-indoor-positioning/324602
But didn't able to find what I want!!
I want my app to know weather user in in particular restaurant or not!! I'v also tried http://developer.android.com/training/location/geofencing.html
but not sure how to use it..
It'll be great if someone help me with where to start and which is best?
Thanks :)
no it is not possible. some companies experiment: for some buildings, that have to be measured to the specific technologiy that those companies use, it may work a bit, but not in general case.
if you want to know the restaurant, enable gps before the user enters the restaurant.
that way you get the position via gps when the user stands before the restaurants door.
as long as the restaurant is not inside a huge indoor shopping center, chances are good.

String comparison

For my project, ppl can give an answer to a certain question they get. I perform userAnswer = etUserAnswer.getText().toString().toLowerCase(); on it and then compare it to a value that is stored in the SQL database.
But I was thinking that it is quite annoying for a user if the answer is just almost correct but if he has written 'kk' in a word instead of 'ck'. Therefor I am trying to create a system which checks if the answer is more or less correct and then returns the result of this. I searched the net but don't seem to find anything on this subject. I also don't know if such a system has a certain name in english?
Or.. maybe somebody knows a good tutorial or a good way to get started?
I guess you're looking for the string distance, for which you could e.g. use the Levenshtein Distance. For alternative metrics, see this question

How to find out a list of locations at a given location on Android?

My goal is to generate a list of all addresses at a given location in latitude and longitude. But I'm not sure how this can be done in Android.
My initial idea was to add a radius of length L to that location, then loop through all points in that circle to list all the addresses. However, I realize this method could take a lot of time, and the result might not be accurate due to the density of each area. Besides, how large should my radius so that the result is rationale to the user.
I wonder anyone has done this before could share me some experiences? Thank you.
Why not just use the maxResults parameter in the getLocationFrom method to make sure you limit your results to a reasonable number? Am I understanding your question correctly?
After doing a bit of research, I found one way to handle this situation is to use Google Place API and returns JSON array of places:
http://code.google.com/apis/maps/documentation/places/

How to find out the country of the user's SIM card on Android?

Is there a way to check what is the user's country? "Locale" isn't good enough because there are plenty of English locales but they are spread all over the world.
Maybe somehow with IMEI or...?
So actually I need to find out which country does the SIM card belong to?
EDIT: GPS or internet are not allowed.
android.telephony.TelephonyManager.getNetworkCountryIso()
More info Android documentation - TelephonyManager.
Edit: Depends what you are looking for. IMEI may not be relevant as the phone might have been ordered/bought from another country or the user might be in another country when using it. Also I don't know if the IMEI tells you the actual contry the device is being sold in, but rather the country of the manufacturer (not sure on this one though).

What Country is the User Currently In?

I've looked around a bit on stackoverflow and Google Groups and haven't really found an answer for this exact question.
I simply want to be able to know what country the user of an Android phone is currently in.
I assume the TelephonyManager doesn't work if the user is using wifi only. Is this true?
We've tried passing the user's current latitude and longitude using android.location.Geocoder, but it's really flaky. It will frequently return empty results. Sometimes we can keep asking it and it will eventually return results, but it's really ugly. Is there a more reliable way?
Thanks,
Rob Sz
You could try reverse Geo Coding :)
http://code.google.com/apis/maps/documentation/geocoding/
Check this link. The country is returned in JSON.
http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false
I honestly do not know whether this will work in all scenarios but I believe this is something that can help.
EDIT: Looks like it kinda works :)
Tried with my country and seems to work perfectly.
http://maps.googleapis.com/maps/api/geocode/json?latlng=6.822716,79.878159&sensor=false
You will get
{
"status": "ZERO_RESULTS",
"results": [ ]
}
for example, if the user is in the middle of an ocean by any chance :P
What about using an IP-based geolocation service? I would guess that due to regulatory differences network divisions are usually fairly country specific, except in cases such as corporate VPN's where you are virtually plugged into the net somewhere else?
Try using a web service, like Chris suggested. Here's a list of a few that will do the trick:
http://free-web-services.com/web-services/geo/ip-to-location/
I'm using http://www.hostip.info, which is nice and simple.

Categories

Resources