Android Network provider, internet needed? - android

I'm using network provider for location updates. Do I need to to have internet on my cell?
Here is my code
LocationMngr = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
LocationMngr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, inteval, 0, this);

I'm getting confused of seeing other's Answer. Then I searched a lot and get some idea about that. While searching only, I have learnt about new concept of A-GPS. I would like to share those things with you.
There are three location providers.
1. GPS Provider
2. Network Provider (AGPS, CellID, WiFi MACID)
3. Passive Provider.
Note: I refer this from this site. As you asked question related to network provider, I will share regarding to that.
Network provider, name itself says that it needs network connection. Refer this article. It need network or WIFI connection to proceed.
A-GPS
GPS on cell phones is a bit more murky. In general, it won't cost you anything to turn on the GPS in your cell phone, but when you get a location it usually involves the cell phone company in order to get it quickly with little signal, as well as get a location when the satellites aren't visible (since the gov't requires a fix even if the satellites aren't visible for emergency 911 purposes). It uses up some cellular bandwidth. This also means that for phones without a regular GPS receiver, you cannot use the GPS at all if you don't have cell phone service.
For this reason most cell phone companies have the GPS in the phone turned off except for emergency calls and for services they sell you (such as directions).
This particular kind of GPS is called Assisted GPS (AGPS).
Note: Even if phone supports it, and network does not then this does not work

No need for Internet for retrieving location (GPS or Network provider). Using Internet can speed up the process and giving you more accurate locations (when dealing with Network provider).

No, the GPS sensors are independent of connections to the internet, so you don't need to worry about internet connectivity if you just want to get your location via GPS. I have a Nexus 10 which has a GPS sensor, and it works just fine when I'm roaming without internet connectivitiy.

no you don't need internet conection.but in some roms it may be some errors in conection.
in gps module you don't need internet but some ways you can use wifi for more performance in.such as google navigation services.

Related

How do I use the device's GPS only whenever there is no internet available?

Android is constantly changing. Currently, the Fused Location API is being used for location detection. But in my experience, without a Data connection, the GPS signal is not being found anymore.
How do I use the device's GPS only whenever there is no internet available?
Fused location provider uses a hybrid way to find gps using a variety of sensors, WIFI/data and the actual GPS chipset.
It will find the location COARSE/FINE accuracy is up to your case. It will just take a while longer than with the internet connection. If indoors or in an isolated area, it may very well take over a minute or two. Sometimes if the data signals just don't reach the device, yes it can fail.
It does work without WIFI or DATA in most cases.

Does enabling Wi-Fi drain more or less battery when tracking location?

I have a mobile app (iOS and Android) that pings the location ~ every 15 seconds and is used in urban areas.
From my understanding
If Wi-Fi is disabled the app will use just GPS for location
If Wi-Fi is enabled the app will either use a mixture of Wi-Fi and GPS or just Wi-Fi
Generally Wi-Fi on drains more battery however if you are tracking location then it might actually save battery since GPS is more battery intensive than Wi-Fi (I think!)
Does anyone have data if enabling (but not connecting to) Wi-Fi will be better or worse for battery life?
Enabling WiFi should be good for battery life, but it depends entirely on how your application is coded. If you take a look at Android's page on Location Strategies, it says: 'GPS, Cell-ID, and Wi-Fi can each provide a clue to users location. Determining which to use and trust is a matter of trade-offs in accuracy, speed, and battery-efficiency.'
It is possible to get the location from just WiFi (yes, unconnected!):
netLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
but this may not be the most accurate solution. GPS uses a fair amount of power, but is obviously more accurate than WiFi, and searching for unconnected WiFi hotspots also takes power. In other words, this is a very complicated question.
All in all, the best solution (to avoid spending all your time coding this location stuff) is just to integrate Google Play services into your app. You can then specify the priority of finding the location (power or accuracy) and Google will sort it for you (check this out or the official google docs here).
protected void createLocationRequest() {
mLocationRequest = new LocationRequest();
mLocationRequest.setInterval(15000);
mLocationRequest.setFastestInterval(5000);
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
}
protected void startLocationUpdates() {
LocationServices.FusedLocationApi.requestLocationUpdates(
mGoogleApiClient, mLocationRequest, this);
}
#Override
public void onLocationChanged(Location location) {
mLastLocation = location;
}
The other priorities are PRIORITY_BALANCED_POWER_ACCURACY, PRIORITY_LOW_POWER, PRIORITY_NO_POWER.
However, back to the question. If we look again at Android's page on Location Strategies and scroll down, it says: 'Depending on the environment where your application is used or the desired level of accuracy, you might choose to use only the Network Location Provider or only GPS, instead of both. Interacting with only one of the services reduces battery usage at a potential cost of accuracy.'
From this, we can draw that using both WiFi and GPS gives a more accurate location than using just one, but that using just one uses less power than using both. HOWEVER, this depends on the environment. Since your app is designed for use in URBAN environments, it is often harder to get GPS signals (due to buildings). But getting a location from WiFi alone does not work all of the time (even in urban environments). However, for your app, since it is used in URBAN environments, I believe that using WiFi AND GPS will be the most power-efficient option for you, because sometimes GPS may not be available or will take a long time to connect (in urban environments). Remember, in urban environments people may lose GPS (e.g. they go into a store or into a very narrow alleyway). But if you have WiFi, you'll hopefully still be able to have their location. Another possible option to think about is trying to get their location using WiFi only at first, and then try GPS only if you can't get their location using WiFi. But this depends on how accurate you need their location. All in all, just leave it to Google (as shown above).
In answer to your question, it depends on how you're finding the user's location. I've suggested how to code your app, but if you want to leave it as it is, please post or comment the code you are using the find the user's location so that it can be determined which option is more efficient.
EDIT: I've seen that this is about iOS as well as Android. iOS provides much less control over how the location is determined. You just plug in the desired accuracy and Apple do the rest. Apple will determine the most power-efficient way of getting the location, and the same stuff that I've written above applies. Anyway, Apple will prompt users to turn on WiFi if it is disabled when getting the location, so trying to prevent use of WiFi for location on iOS is pretty much impossible.
GPS power consumption is extremely high compared to WiFi. Most phone lasts less than 10 hours on GPS while with WiFi they can last more than day.
WiFi is not only for location or the internet, it has multiple uses,
if you are using older os than Marshmallow, you can't disable all functionality to use WiFi while it is on.
from Marshmallow you can enable it for the specific use like location only.
so it will consume less power than GPS.
while in the prior version, GPS is in winning condition in power consumption.
https://android.stackexchange.com/a/127571/116948
I don't have any hardcore data on the subject, and doubt anybody will have any concrete numbers, but theoretically Wi-Fi will be far better than GPS only. The theory works something like the following: In order for a GPS to know where someone is at, it needs to receive information from 3 different objects at known locations and use triangulation to figure out its location from that, whereas wifi only needs to make one call, to the nearest internet repeater, which has a known location and known path. In order to assure accuracy this is often done multiple times with each location request. Thus the extra calls add up and Wifi will be more efficient.
Use WiFi whenever you have access to a network because it uses less battery than GPS. (Shorter distance, lower power.) Turn WiFi off when you don't have access to a network, otherwise it will keep looking for a WiFi network it can use (which drains battery).

Google maps Android API getting wifi location

So I am working on this app that will get the location of a wifi hotspot by just detecting it using the sensor wifi of the phone (The phone is not actually connecting to the hotspot wifi, it just detect).
I was doing some preliminary research before start developing the app, and it seems that the Google Geolocation API will do the work for me. However, it is not free (at least what I understood after reading through the API). I had checked other apps that detects wifi hotspot, and I am just wondering if those apps have their own database with all the wifi hotspot information (SSID, location coordinates, etc) so when the wifi sensor detects a wifi hotspot, it will lookup the database and get the information such as location.
Also, I was mentioned by a colleague that Google Maps also stores wifi info. Is is true? Cause I couldn't find any info about that.
Android has multiple LocationProviders, including:
LocationManager.GPS_PROVIDER : get position using GPS
LocationManager.NETWORK_PROVIDER : get position using Wifi, cell network, etc.
LocationManager.PASSIVE_PROVIDER: get position using data provided by already running providers. This allows several apps to share geolocation information)
You don't have to pay anything to use NETWORK_PROVIDER
Some providers might not be present on all devices, depending on phone model and android version.
Providers have different characteristics: NETWORK is fast but not always precise enough, GPS is precise but slow and battery intensive, etc. The best strategy is to request location from several providers, and cancel pending request as soon as you get a location that is good enough depending on your criteria (precision, response time, etc.)
I found this article by Reto Meier quite useful to wrap my head around geolocation on Android

What is GPS,AGPS,LBS in android?

I'm working in android (developing application for mobile and tablets). I am using android version is 2.2.
In my application, I want to capture the longtitude,latitude.
My suprevisor is said to me capture the locations using GPS,AGPS,LBS
I'm new to android .I does not know GPS,AGPS,LBS.
Please send me the details, what are the difference,advantages,disadvantages of these 3?
Don't compare LBS with GPS and AGPS. LBS stands for Location based services . It's a service done with the help of GPS/AGPS . For example 'Requesting the nearest business or service, such as an ATM or restaurant' is a service required by a user. There are many applications available for to provide above service. Those application will use either GPS/AGPS to find the location and service to user based on the location fetched.
So simply any application which use location to serve users are considered as LBS.
Following is the difference between GPS and AGPS
The difference between GPS and A-GPS is actually pretty straightforward. A GPS phone comes with a built-in GPS chip. GPS, short for Global Positioning System, is typically used to determine the location, speed, direction and time of the device. So, for example, in the case of the Mobile, when GPS is activated on the unit, the system would be able to triangulate the position of the receiver when three or more satellites are connected. And since it is able to calculate speed and direction, GPS is also commonly used as a navigation device while driving.
A-GPS (Assisted-GPS), on the other hand, was developed to enhance the performance of GPS. This is especially useful in environments where the GPS chip may have difficulty in getting a satellite signal, such as an urban canyon, or places where there is too much overhead obstruction. What A-GPS does is it leverages on an intermediary called an Assistant Server which provides information on cell ID or other data to help the device identify the right satellites to connect to. This shortens the time needed for a location lock although certain A-GPS solutions require an active connection to a cell phone network.
Pros and Cons of GPS and AGPS:
The realiability and Accuracy is high in the GPS and it is low in AGPS.
The location captured by AGPS is not as accurate as GPS.
The location capturing via GPS is time consuming and power (Battery) consuming, etc.
Hope it helps. For more details on A-GPS
GPS - Global positioning system -> get your location via satellites
AGPS - Assisted GPS -> get your location via satellites and network providers
LBS - Location Based Services -> doesn't have much to do with getting your location.
Basically, in Android you can get your location using following providers:
Network: get your location based on your wifi connection. fairly fast, but not so accurate
GPS: get your location based on GPS receiver. fairly slow, but quite accurate
so you have a trade-off: either to use Network provider and get your results fast, or to use GPS provider and get more accurate data.
Read more here:
http://developer.android.com/guide/topics/location/strategies.html
LBS - Location Based Services
GPS - Global Positioning System
AGPS - Assisted Global Positioning System
LBS
As abbas.aniefa said, We can't say differences of LBS over GPS and AGPS. It is the service which uses GPS/AGPS to find location. Android provides a number of building blocks for location based services.
GPS
GPS, the Global Positioning System run by the United States Military.
This provider determines location using satellites.
Depending on conditions, this provider may take a while to return a location fix.
Advantages
It will give our location accurately,
It will work fine in out-door locations.
Disadvantages
It may be very very slow in in-door locations,
It will quickly drain battery.
It will be slower than network provider.
A-GPS
A-GPS - Assited GPS. Normal GPS can take a long time to get a position fix. For this reason most cell phone companies have the GPS in the phone turned off except for emergency calls and for services they sell you (such as directions).
A-GPS will come under network location provider category because it uses GPS chip on device, as well as assistance from the network (cellular network) to provide a fast initial fix.
Advantages
It will give our location very accurately in-door location itself,
Drainage of battery will be saved,
It will be faster than GPS Provider.
Disadvantage
We can not use it with GPS alone. It will depend on network connection.
Over all Differences of GPS and A-GPS
GPS
Uses GPS chip on the device,
Line of sight to the satellites,
Need about 7 to get a fix,
Takes a long time to get a fix,
Doesn’t work around tall buildings.
A-GPS
Uses GPS chip on device, as well as assistance from the network (cellular network) to provide a fast initial fix,
Very low power consumption,
Very accurate,
Works without any line of sight to the sky,
Depends on carrier and phone supporting this (even if phone supports it, and network does not then this does not work).
I think GPS is done/processed via satellite communication without any network service provider.
The AGPS is done/processed via the network (which is provided by service provider such as Airtel,Vodafone,etc).We should pay for service provider for usage of network.
The LBS is processed through the AGPS.
I dont know whether my points are correct or not.Im heard from others and put it.
All are welcome to give their suggestions,ideas,etc.

GPS Location without service

I am a new developer and have a simple question that I have searched all over for, but have not found a clear answer yet...
Simply put, I am developing an application that needs to be able to use GPS. The trick is however that I would like to use GPS to get a phone's location even if they have no carrier service.
With that said I have 2 questions.
Is is possible to get the GPS location of a phone with no carrier service with a wifi connection?
Is is possible to get the GPS location of a phone with no carrier service AND no wifi service?
Thanks in advance
Yes, it is on many handsets. The WiFi network may be mapped which will speed up the AGPS chip, or allow offloading of position calculation to the provider.
Varies by the GPS chip in question. In some cases, it will simply not work (the GPS processor requires network communication). In most cases the GPS will take up to 10 minutes to fix from a cold start, as it must receive the current satellite almanac in order to compute position.
While it it true that AGPS is dependent on some kind of data communication most Android phones have true GPS chipsets which means that they communicate with satellites in space regardless of any data connection. This will provide a more accurate position, but will be slower to acquire. Your best bet is to listen for position updates from both Network and GPS providers so that phones with a data connection will get a fast, rough fix that can be refined by the GPS and phones that don't have a data connection will simply not raise an event until the GPS gets a fix. If you want to be extremely robust then don't block waiting on the fix so the user can at least continue to use your app instead of staring at a spinning icon.

Categories

Resources