Cellular network location service draining too much battery?(android) - android

we are developing an application in android which uses cellular(GSM) network location service (NOT GPS).Drains battery very fast when we use this location service in our application...
I dont know what causes this draining .. any pitfalls, suggestions?
thanks for help

Instead of requiring the location every time you have to request the Last Known Location.
Get the Last Known Location
check:
Fused Location Provider
use the fused location provider to retrieve the device's last known
location. The fused location provider is one of the location APIs in
Google Play services. It manages the underlying location technology
and provides a simple API so that you can specify requirements at a
high level, like high accuracy or low power. It also optimizes the
device's use of battery power.
Read more:
Adjusting the model to save battery and data exchange

Related

Regarding Fused location Provider in Android to Fetch Location

It seems to be a silly question but it might affect the design of application that I m developing .
Fused location providers provides location data in onLocationChanged () callback only when device gps is turned on. So i m confused what's the benefit of using fused location provider if It has such a dependency on device gps ?
Please help to explain
Thanks
What's the benefit of using fused location provider if it has such a dependency on device gps ?
The FusedLocationProvider may or may not use GPS, depending on the accuracy and update interval that you request. The main benefit is that the FusedLocationProvider conveniently abstracts the process of choosing suitable providers (WiFi, GPS, Network, BLE) and fusing the location info from those providers, hence the name.
The best choice of providers can depend on both the capabilities of the client device as well as your physical surroundings (e.g. WiFi might perform better than GPS in an urban environment with lots of tall buildings, while out in the wilderness it will be the other way round). So unless you need fine-grained control of the location providers I would suggest letting the FusedLocationProvider / the Google API decide.
Regarding application design: I have written a utility class, called the LocationAssistant, which will actually handle most of the setup for you. You might find it useful, as you're left with only a few simple interface methods to implement.

How Fused Location determines if use GPS or Network provider?

I am developing an app in Android that reports location to a server, and I was wondering to implement the new released Fused Location API, made by Google. Testing it, indoors and with setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
instantly takes networks providers to get location. So, my question is, what see Google in a few seconds to determine that gps is not a good option? I know that gps provider doesn't works properly indoors, but in my office sometimes (it takes an average of 10 secs) it works. Thanks
Well the library itself is not open-source, but I'm sure we can agree on how it does what your describe above:
If the GPS provider is disabled, or if the signal is too weak, or if the fix takes too long, then it returns the last known location and/or the network provider's location.
Seems reasonable. I guess the network provider serves as a fallback to the GPS provider in PRIORITY_HIGH_ACCURACY if GPS is not satisfying.
EDIT
Actually, the documentation says:
PRIORITY_HIGH_ACCURACY
This will return the finest location available.
It does not say it will only use GPS or prioritize GPS at all. It will just return the finest location, which is not always GPS, as #cYrixmorten pointed out: in urban areas, wifi spots are often more accurate.

Making an App that requires constant current location

I am trying to design an app which requires current location of the user time and again. So, whenever cellular data is available, i use mobile network to get the current user location. If mobile network is not available, can I reliably use GPS to get access to current location. If not, can anyone suggest what should I do in such cases?
Edit: Location services doesn't work very well. I already tried using it.
I think you should take a look at Android Location APIs:
https://developer.android.com/google/play-services/location.html
Android uses what they call Fused location provider. It is Android (through Google play services) responsability to choose which provider (GPS, sensors, WIFI fingerprinting...) is best each time to get current user location.
I think it is a great technology and APIs are really simple to use
According to Google Docs:
Knowing where the user is allows your application to be smarter and deliver better information to the user. When developing a location-aware application for Android, you can utilize GPS and Android's Network Location Provider to acquire the user location. Although GPS is most accurate, it only works outdoors, it quickly consumes battery power, and doesn't return the location as quickly as users want. Android's Network Location Provider determines user location using cell tower and Wi-Fi signals, providing location information in a way that works indoors and outdoors, responds faster, and uses less battery power. To obtain the user location in your application, you can use both GPS and the Network Location Provider, or just one.
If you want more detail you can take a look at :
http://developer.android.com/guide/topics/location/strategies.html
yes If there is no Network available then you can go for GPS but we must use it smartly and efficiently
because GPS give much accurate location than network, but it reduce the battery life and also you can use Pending Intent for getting location and broadcast receiver at the place of Location Listener
but I suggest you this link with light this topic in much detail
These are some smart coding concepts for increasing battery life

How I can get the location of the device if the GPS is off?

I would like to get the latitude and longitude of a device, if the GPS is off, well hopefully can be a precise location
You should use the new LocationClient that is part of Google Play Services Location API. It uses a fused provider that automatically determines what is the best provider available at that moment. It also uses other sensors to get a more accurate location.
you can get your location from three techniques and each one called Provider and each one has some pros and drawback and uses you don't care about it Google play services will making it for you but you need to have good understand of that , the three ways is
from GPS , Network , SIM(mobile device with sim)
and here some implementations of the techniques
http://developer.android.com/guide/topics/location/strategies.html

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.

Categories

Resources