So I know next to nothing about GPS and Apps, but I do want to get my feet wet and have a (simple-ish in my mind) idea for a simple app based on GPS or manual address.
I basically need to know if you can do something like this
if GPS Location is (11.111/22.222) { Show(**THIS STUFF**) }
or if manual address is (555 Main St, Salem, OR) { Show(**THIS STUFF**)}
in android or iphone
You can. It's considerably more complex than that. And there are apps for both platforms that do exactly that. A quick search of Google, Apple Store, and Android Market will tell you what the current apps for that are.
If you want to do this yourself you will need to learn some new concepts. Geofencing (geographic buffers). Geolocation (address to coordinate conversion). And read up on how to efficiently use the location services provided by the devices you are writing for.
You should use android location api for GPS Location, and check in the onLocationChanged() method : if(myLocation.getLatitude==11.111 && mylocation.getLongitude==22.222)
On manual adress You should use android maps api.
Related
I want to make app without use of GPS, and my app is using user's address. so for that i want any idea of getting address without GPS. I want address, not latitude and longitude. Geocoder can be use for getting address but its again using GPS. Please provide solution for my question.
without GPS you can not find address
Get the user to manually enter their address. or bite the bullet and use geo-coding.
EDIT:
you have 2 choices:
1) Use lat/lon and geo - coding to determine the address
or
2) User manually enters either lat/lon or address (which will not go down well)
1) You can get IP address by either $_SERVER['REMOTE_ADDR'] in PHP or using some external JavaScript application, and then pass it to some API like freegeoip and then pass received coordinates to Google. It's quite easy, but it's not reliable solution - it can be very accurate or totally inaccurate.
2) (preferred, but needs permission) You can ask user for with HTML5 Geolocation for his location and it's much more accurate (and then pass it to Google Reverse Geocoding)
I'm using intel xdk and cordova for an android app that uses geolocation this is the code that i use:
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(geolocalizacion,error,{enableHighAccuracy:true, maximumAge:Infinity, timeout:100000});
} else {
handleNoGeolocation(false);
}
I don't want to use the 'google location service' because, if that option is disabled, some people can get lost trying to find it in settings, so i'm using enableHighAccuracy:true in order to use GPS.
However with that it takes so much time, almost a minute to call the success function 'geolocalizacion' when the app is used indoors. I know that GPS is better in outdoors (in that case it takes 5 or 7 seconds) but i think 1 minute is too much for indoors.
Am i doing something wrong?
Is there a way to make faster the geolocation with GPS?
or a way to activate the 'google location service' without the user doing anything?.
The GPS signals transmitted by GPS satellites are very weak if you are not located outside. Even if you are outside, weather conditions, tall buildings and other large metal structures can hide or degrade the GPS signal. In addition, the GPS receivers inside of your typical phone or tablet are very low grade receivers and antennas, they are not as capable as the more expensive dedicated GPS devices, due to compromises associated price and physical size.
You should really take a two prong approach: get an initial reading using the "coarse" geo reading, with the geo cache enabled. The coarse reading will use the wifi, network, GPS and cached readings and return it's best estimate based on the parameters you specify, usually within a very reasonable time frame.
Then, after you've established an approximate position (which can be very accurate, as #SeahawksRdaBest points out, if based on the current wifi), switch to the "fine" location setting to get an accurate position. This part of your app can run in the background so it doesn't interrupt the responsiveness of your app, and can then update the position information in your app as more accurate position data becomes available.
One thing to keep in mind, many users have the GPS turned off because it severely degrades battery life. If all your app needs is to "find a restaurant nearby" then the coarse location should be good enough, since you're probably more interested in placing the destination on the map. This will be much more battery friendly, and is one of the reasons that the geo settings on the more recent Android devices have changed to make it harder for an app to enable GPS programmatically.
I see you've added the intel-xdk tag, so you might want to checkout this little geolocation test app that I've put together at https://github.com/xmnboy/hello-cordova. It needs a little work but should help you with some experimentation between coarse and fine settings.
I think you can diversify your app a little.
For example if you are indoors and have a WiFi connection why not use that to triangulate your position? WiFi is highly accurate because theoretically it covers a small space so the phone would know exactly where it is and return a position quickly.(if done right in my experience usually <10 secs).
If a Wifi connection is not found(outdoors). You can always drop back to GPS to provide the coordinates. Plus Gps is "fastest" outside anyways.
Checkout these pages: Stackoverflow discussion. Location Manager Android.
If you want to get really fancy you can even use the Geocoder Android library to get Location addresses etc in human readable form.
I want to know how Geo Location is found through a Network provider without GPS in an Android application?
How exactly is triangulation of cell towers implemented in code and how is latitude and longitude of the cell towers is obtained to get the accurate location through NETWORK_PROVIDER?
Where exactly can I find the source code which implements this functionality? (Android is a huge codebase and I don't know my way around it).
I cannot use the LocationManager or LocationProvider or any class or objects directly as I want to mimic this functionality in hardware so I just want to convert the source code to C with same functionality.
Sorry to say, but Google has not open-sourced this part of the code.
You can see LocationManagerService - it talks to a remote service using a LocationProviderProxy. The implementation is in a NetworkLocation.apk in pre KitKat distributions and shipped by Google on every Android phone. (In KitKat it is in Google Play)
Relevant package name for KitKat :
private static final String NETWORK_LOCATION_SERVICE_ACTION =
"com.android.location.service.v3.NetworkLocationProvider";
Google uses WiFi positioning data + Cell ID information for triangulation.
I think you want to know how cell ID position occurs - there are many positioning protocols that have evolved from 2G to WCDMA to LTE. I think you will find this Spirent white paper interesting - An overview of Hybrid Location technologies
I'm looking for a way to know the country-level location.
How to do it on a phone, or devices that have cellular network connectivity or GPS is clear. But what about devices that don't have that?
I know from Google Analytics that Google has that kind of location information,
How?
How can I get that information as well? Maybe from the play-store locale or something?
By "Tablets" I mean devices that have no GPS and no GSM / cellular network connection.
10x
Use the WiFi aproximated location. It checks your IP adress and tries to locate it geographically.
please see this or this.
a quick summary of the WiFi location method form one of the posted links:
How it works: Unless you opt out, your phone is periodically sending anonymous data to Google with, among other things, your last known location and any Wi-Fi network you were connected to at the time. The accumulated data builds on a database begun by traveling Google Streetview cars that recorded Wi-Fi networks available along their routes (the cars no longer do this).
When using this method, your application will ask for the COARSE LOCATION permission on installation.
Since there's no clear indication (at least none that I've found) whether or not Google estimates location based on IP as a last resort, my 'getCountry' logic would be as follows:
Location location = LocationClient.getLastLocation()
If (location == null) location = getLocationByIp()
where getLocationByIP() will use a publicly available, RESTful free web service such as http://freegeoip.net/
Open to suggestions here. If line 2 is redundant I will be happy to drop it.
Cheers
(Y)
I'm working on a app which requires that a device with this app installed will automatically find other users within a maximum radius of 200ft (worst case scenario 300ft, but that's pushing it) and/or a minimum radius of 40ft.
Ive tried the obvious solution of using GPS and a MYSQL query that query's our location table for other users within the 200ft radius, but as you probably would guess this is not incredibly accurate and if the device uploads coordinates that are off by over 200ft the server will return a list of users that are not within proximity. While I would prefer to just get the app to work the way it was meant to I'd rather the server return no users than false positives.
I know there's probably no simple way to do it accurately, but what other options do I have? And how did Color manage to do it? With all the tech in the avg smartphone and all the location based apps this has to be possible to do.
200ft (60m) is no Problem for GPS. Usually GPS is below 10m.
You even have a location.getAccuracy() method which you should evaluate
Just use GPS as your only location source. do not use cell tower location provider, when you want accuracy < 60m.
Of course inside a building, when you are sitting at your desktop GPS will not work, or is off by 60m.
GPS needs a view to open sky not obstructed (by dense materials).
Take a look at this question:
how to get the most accurate location using GPS and AGPS with given time in android?
Basically it depends on the phone's GPS and the current environment. Besides that, there's probably nothing you can do to further boost the location accuracy other than using GPS.