How can I get rough location (country) forAndroid Tablets - android

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)

Related

Android GPS location accuracy issue

I am working on gps tracking apps in android. Here is my code architecture:
BackgroundSyncService : A service class that is used for getting location update. Here GoogleApiClient is initialized and implements others Location related methods.
AppRunCheckerReceiver : A BroadcastReceiver class that will check if my BackgroundSyncService is running or not in a time interval. If it stopped then it start.
GpsEnableReceiver : A BroadcastReceiver it will fire if gps status changed. It will check if my BackgroundSyncService is running or not in a time interval. If it stopped then it start.
InternetConnectionStateReceiver : A BroadcastReceiver it will fire when internet status changed. It will check if my BackgroundSyncService is running or not in a time interval. If it is stopped, then it start.
In my BackgroundSyncService service I initialize the GoogleApiClient using this way:
public void setLocationLocationRequest() {
try {
googleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this)
.addOnConnectionFailedListener(this).addApi(com.google.android.gms.location.LocationServices.API).build();
locationRequest = new LocationRequest();
locationRequest.setInterval(3000);
locationRequest.setFastestInterval(3000);
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
googleApiClient.connect();
} catch (Exception e) {
}
Here accuricy is LocationRequest.PRIORITY_HIGH_ACCURACY and interval is
locationRequest.setInterval(3000)
here is the GoogleApiClient implementation code.
This application GPS info section contains Latitude longitude and Accuracy parameter
My Findings: in onLocationChanged(Location location) method I check the accuracy of Location object in this way : location.getAccuracy(). Here if accuracy is less than 50 meter, then I accept it.
In 85% of the cases it working like a charm. It sending me exact location from GPS. But in 15% cases, it sending me inaccurate location like more >300 meter.
The 15% device are low cost China brand mobile.
My Questions:
How can i make accuracy level near 99%. Is there any problem on my code architecture?
Does GPS accuracy depends on device configuration? if YES then what can I do for low configuration device?
How Uber, Go-JEK etc. ride sharing apps works for all device? Is they have extra coding for GPS only?
My application is for Bangladesh. Here internet is slow. Is it has negative impact on GPS accuracy?
Thanks in advance for this thread. And also sorry for bad english.
How can i make accuracy level near 99%. Is there any problem on my code architecture?
This is real life scenario. You cannot ensure that all the location providers will work as expected. You should ask for best available position.
a) Does GPS accuracy depends on device configuration?
YES. Some devices may have older GPS chipsets which can only track GPS signals (USA) since there are other positioning systems like Galileo (Europe), GLONASS (Russia), QZSS (Japan) and Beidou (China). The more the chipset support for these types the more chance you get to track more satellite hereby position fix. Also TTFF (time to first fix) depends on how many channels do the gps receiver has.
b) If YES then what can i do for low configuration device?
Since this is a hardware issue, you cannot do anything here. But other location sources can compensate the lack of GPS data such as AGPS (aided gps), wifi and cellular positioning. Also there are some paid options which provides a database to locate your device using wifi access points and cellids (they claim that they provide best solution on wifi but i m not sure as I dont use it. you can check it out http://combain.com). Wifi and cellid also depends on how many wifi access point and cell tower available around and how far they are (signal strength). If you need 50m accuracy, cellular positioning has nothing to do but wifi has a chance to get closer to this value.
Some study results from 2009 [3]
3G iPhone w/ A-GPS ~ 8 meters
3G iPhone w/ wifi ~ 74 meters
3G iPhone w/ Cellular positioning ~ 600 meters
How Uber, Go-JEK etc. ride sharing apps works for all device? Is they have extra coding for GPS only?
They may have specific Location strategies but it will based on using other sources during GPS outage.
My application is for Bangladesh. Here internet is slow. Is it has negative impact on GPS accuracy?
Other answers claims that internet is not related to GPS. Yes it is true it is not related to GPS but location. AGPS uses internet to fetch 3 types of data (Satellite signals, almanac and ephemeris) which assist GPS to provide position fix faster. If ephemeris and almanac are outdated or the device moved several hundred km from the previous position fix then it is called cold start and takes around 12-15min without AGPS.
Fused location provider already knows how to provide best solution with these configurations, so you should bless it.
References:
[1] http://gpssystems.net/agps/
[2] http://gpsinformation.net/main/almanac.txt
[3]
https://communityhealthmaps.nlm.nih.gov/2014/07/07/how-accurate-is-the-gps-on-my-smart-phone-part-2/
First, (and second)
How can I make accuracy level near 99%. Is there any problem on my code architecture?
Does GPS accuracy depends on device configuration? If YES then what can I do for low configuration device?
Both - device configuration and code architecture, are important here. If you are already at an 85% success rate, the code architecture is alright I think.
As far as GPS goes, line-of-sight is an important factor when it comes to device configurations and accuracy.
Although a low cost mobile could return an accurate location with a clear line-of-sight. You can try running 2 cycles more/waiting to attain higher accuracy.
In a worst case scenario and for what its worth, you can also try retrieving location using the LocationManager and GPS provider technique which works as a fallback in the 15% just to compare and ensure you are using the most accurate location you can get.
Location Strategies put it as
In most cases, you'll get better battery performance, as well as more
appropriate accuracy, by using the Location Services API.
How Uber, Go-JEK etc. ride sharing apps works for all device? Is they have extra coding for GPS only?
They do work but not always with highest of accuracy for locations received within the app. If there are any location hacks for us developers, we need to find them, maybe a 5th page google search result :) or benefit from the open source environment. For me, best practices and android repo links suffice. You have already followed posts like Receive location updates
My application is for Bangladesh. Here Internet is slow. Is it has negative impact on GPS accuracy?
No relation between Internet and LocationManager + GPS_PROVIDER

How to get location of the caller when get a call in android

Is it possible to get location of the caller when get a call? If so provide some links to achieve it. Thanks in advance..
Edit: OR else how to get at-least approximate location or lastly State name of the incoming number.
No. That data isn't carried over the phone call in the metadata, and there's no data connection in a phone call. Nor does it make sense for it to be sent- that['s a security nightmare. How would you like it if your worst enemy could find out where you are at any time just by calling you? Or a pedo could find a child's location by calling their phone? Or a rapist a woman's location by calling her? It's a bad idea. If you want to share your location with someone there's a variety of apps that do that, and just about all of them allow you to restrict that knowledge so you have some security. Use them instead.
Getting the exact location of a caller in mobile networks is theoretically impossible, due to the architecture of mobile networks.
Briefly speaking, Mobile networks divide land areas into "Hives", which determines a closed ploygon. The shape of the polygon is normally a hexagon which is adjacent to other hexagons. These hexagons are covered by BTS towers, which are responsible for responding to call requests, routing and call hand-over.
Some but not all providers enable their BTS to report their GPS coordinates and the database of all these coordinates is some kind of confidential data.
Again some but not all providers, make their databse of BTS towers available , which depends on the host country regulations and the provider company policies.
However there are databases on the web, which gather this coordinates of different providers but since the data is not gathered or distributed in an online and timely fashion, there may be complications, let alone the web service you need to use for querying which normally is not provided.
But since I assume you're in India, you may find this website useful.
EDIT
After googling , I found these websites that provide Cell-ID databses.
https://unwiredlabs.com/2
http://location-api.com/
http://www.opencellid.org/
https://wigle.net/
http://cellspotting.com/webpages/cellspotting.html
http://www.cellmapper.net/
http://www.opencelldb.net/

How to send latitude and longitude to webservice in android without internet?

I have an idea of making an app in that truck drivers are there with GPS,SO they will get latitude longitude without internet,there will be an admin panel which can track the truck driver's location and location history,So My question is that the truck drivers will only having a GPS enabled Android device (WITHOUT INTERNET),SO how can the admin will track their location? Please suggest me for it .
I suppose you could try SMS messages, though, it might become rather expensive if the re-fresh rate for the location is high.
In simplest solution you would have a mobile device (you need to find one which incoming SMS you can fetch to the PC, might require some internet searching time) with normal number for receiving the SMS messages, or you could see whether you could get Operator service numbers (see whether using free-to-send number would be cheaper) and then get the data from the operator.

How to force android's locationlistener to fetch provider location?

I have written a small app that receives the location from mobile 3g/wifi by using locationManager & NETWORK_PROVIDER parameter.
according to google's api it will get the location i wish (the other option is using the GPS_PROVIDER)
what i really desired was the WIFI location. I wanted to see its behavior and how the phone gets its location (i.e with wireshark)
in order to do that, i changed into flight mode & activated wifi.
then, i launched the app and clicked the button which starts the NETWORK_PROVIDER location service by calling the requestLocationUpdates function with time parameter = 10.
what that actually happened is that i managed to get the location but saw no traffic at all in wireshark.
could it be that Google gives me the approx. location in advance, when connecting to the wifi? (its the only explenation)
If so, is it possible to clear that cache, or whatever data it have stored, and force the phone to get a new (but the same) location?
Thanks in advance,
Eran.
Have you tried re-booting the phone, just so to remove any cache files which might be storing the location?
Since NETWORK_PROVIDER use cell location, wifi ssid and their signal strength to get your GPS coordinates.
Since you are in flight mode and cannot get cell location, just try to switch the connected wifi , maybe google service will be invoked to get new location.

Do "x" based on GPS location or manual address (android /iDevice)

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.

Categories

Resources