Using the GPS to detect whether an android device is indoors - android

The app which i'm writing need to somehow detect if an android device is indoors or outdoors. My goal is to detect if the user left a certain building as soon as possible.
I tried to use the user location signals. I'm not initiating any GPS sampling since I don't want to waste too much battery power, so the only way to detect if a user left a building is to wait for him to be far enough from the place and then use location signals which were sampled by wifi or cell.
The problem is that it takes quite some time for me to detect that the user left the building.
I know that when a user is indoors, his GPS signal is weaker. Can I somehow use the GPS status to find out if the user is indoors or outdoors? Will it be wasteful as initiating a GPS location sample?
Thanks.

I don't think you can do what you want to do with the FusedLocationProvider as this uses WiFi and cell tower triangulation. You will need to use the LocationManager.
It is also difficult to detect if you're inside and as far as I know there is no definitive way of doing this. You can make informed guesses however.
In terms of detecting a "weak" GPS signal you have a few things you could check:
The number of satellites available to you. If a low number then you are either indoors or somewhere with poor satellite coverage.
The horizontal accuracy of a received GPS location. If this value is high it can be deemed as poor accuracy which could be because you're inside.
No location has been received for a period of time. This could be because you're inside.
Have you thought of doing other checks as well as GPS so if they're connected to WiFi it increases the likelihood of them being inside?

Related

How accurate location can we get through an android device?

I am using Android Location class to retrieve location from device. It gives location and Accuracy in meters.
I am using Samsung Galaxy S3. Getting below location details:
When I turn on Sim network and GPS, I can location as accurate as of 8 meters.
Surprisingly when I turn on GPS only, I can get location accuracy of say 36 meters.
My question is location accuracy depends on what?Does it depend on a device(if its high quality device then good location accuracy) ?
Does it depend on county in which we are using device (depends on its phone or GPS network) ?Or it depends on some thing else ?Any inputs !!
In short it depends on BOTH
Your GPS give accurate results with help of Mobile Network and WIFI.
From Android official website "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."
Does it depend on a device(if its high quality device then good location accuracy) ?
No, doesn't depend on device.
Does it depend on county in which we are using device (depends on its phone or GPS network) ?
Or it depends on some thing else ?
Sort of, if you have good reception and connected to nearby wifi, your accuracy will be close.
GPS accuracy depends on:
1) Availability of assistance. You should be connected to WiFi or cell network so that latest satellite orbit models can be downloaded to the phone.
2) Signal strength. A stronger signal means (usually) better accuracy. More satellites means (usually) better accuracy. You must have the orbit model (aka ephemeris) for a satellite to use it.
3) Direct signal path to satellite. Bouncing signals add length to the path and dilute your position accuracy. Hard walls, water towers, metalized glass windows, all bounce GPS signals. If the reflection is stronger than the true signal, you can have a problem.
4) Antenna and RF path of the GPS inside the device. manufacturers who make good antennas get better performance because it gives a stronger signal for every satellite. Antennas that are directional or have large nulls are not good if pointed in the wrong direction.
5) Frequency stability of the oscillator in the handset. The oscillator is the reference to measure time delays. Every GPS receiver has one. Oscillators should change frequency only slowly (under 1 or 2 parts per billion in any given second). Oscillators hate heating, they hate electrical noise on their power supply, and a few other things. This is something designed into a phone, you can't change it. Putting the oscillator next to a power amp or SD card controller is a bad idea because they get hot.
The best GPS accuracy is obtained with an outdoor device, connected to a network for assistance, in an open field with good view of the sky. You should be 50 meters or more away from any building, wall, or surface that can reflect a signal. Salt water can also reflect signals, fresh water usually does not.
So that's the answer on GPS but it doesn't answer your full question. It sounds like the additional setting also uses some other positioning technology, probably WiFi. Try turning off the WiFi and see what kind of accuracy you get at the same time in the same location. WiFi can be very accurate, especially if there are multiple WiFi APNs that your phone can hear.

Does fetching gps location in high accuracy mode deducts money from our balance?

Hi I am working on a project which requires fetching of user's current coordinates and I am fetching it in high accuracy mode.
Ever since I started testing out this application in my device I have noticed that my money is getting deducted from my balance I am not sure why is it happening.
I currently dont have a data pack and my mobile data is turned of in my device but I am connected to wifi. Even if some application is using internet for some purpose it should make use of the my wifi connection right?
Can anyone please explain me why is my balance getting deducted (if you have faced similar issue) ? Is it really because of the fetching of location in high accuracy mode ?
Thanks.
Edit
I get this dialog box frequently:
GPS coordinates on a android device (or any device for that matter) is received in 2 ways.
From a GPS hardware that connects to your GPS Satellites
From your network, via the GPS location of the tower to which your SIM card is connected to.
The GPS hardware connects to multiple satellites and approximates your location to a point. And this location is the most accurate you can get. It consumes a lot more battery and decipates a lot more heat on the devices, since a lot of current is needed to read from the GPS satellites. This does not use the network at all. If your SIM card cannot make phone calls/and/or/data even then this location can be received.
Your network GPS also does similar, but it takes GPS coordinates of the towers closeby (to which the SIM card is connected to, and then approximates the location of your device. This GPS location (in comparison with the GPS hardware) calculates a less accurate. This consumes GPRS/3G data bandwidth and you will be charged for this.
Both the hardware are completely independent.
Now, some smart ass developers in Google have used sensors like compass, rotation, movement to develop something called AGPS, which takes the GPS location from the GPS hardware, and then uses network and sensor information to ensure that your location is known without use of too much power, and there by lesser heat decipation. This is called AGPS.

android GPS calibration

When moving a big distance, like to another city, with the GPS off, it takes very much time for it, when turned on, to get the first correct point.
So if by example I register to the gps provider, it could take up to 10 min until the first onLocationChanged call.
The network provider will respond faster, but is less accurate.
Is there a way to help the gps provider? To give it an approximate location (the one from the network provider), so it can find my location faster?
I think that google maps made some kind of optimisation, because their app finds my location faster than my basic app, that only register to the gps provider.
Any idea how I could accelerate the process of obtaining my location with decent accuracy ( <30 m) ?
You are right that if you move a long way with the phone switched off, then it can take a long time to get a satellite fix. This is where AGPS helps. The 'A' stands for 'assisted' which is very much carrier and handset dependent in its implementation. In essence it gets an approximate location from cell towers or from public WiFi like coffee shops and then downloads ephemeris and almanac data which tell the phone which satellites are likely to be overhead at that time in that rough location. The phone can then start listening on the frequencies corresponding to the visible satellites first. This should speed up the time to first fix.
Common practice is to use WiFi SSIDs or the location of the cell tower you're registered with to look up your current location via providers like WeFi or Skyhook. Google uses its own service for that (and sees that no one else does).
Another method would be, in case your smartphone has a barometer, to look up the air pressure and try to pin it down to a location. While all these methods can theoretically be used offline, it is easier to fetch the data from the internet.
Also note that inaccurate NTP settings on the phones may lead to longer GPS search times.
Is there a way to help the gps provider?
NickT has answered this, but the android phone has to call the AGPS. In your app you cannot controll that.
I think that google maps made some kind of optimisation, because their
app finds my location faster than my basic app, that only register to
the gps provider.
This should not be the case, probaly you are doing something wrong, or the google app can enable assisted GPS. Try to compare with other android GPS apps (e.g compare with Motion-X-GPS)
it could take up to 10 min until the first onLocationChanged call.
Normally this is far too long, either your phone is known to have a weak GPS quality, or the device did not have free view to open sky. Even without assisted GPS, after 45 seconds, you should have a valid GPS position (asuming free view to open sky).
But this situation can happen, either the first time you use GPS on your device, or when you fly by airplane to a location far away to your last GPS position.
On my iphone i rarly saw such a situation when another GPS app was somehow disturbing, after a reboot of the device the GPS was immedeatly valid.
Again check if it is the fault of your app, by comparing if other apps needs 10 minutes too. (It could be your fault, when you wait to recieve an accuracy <30m while other apps would take the first valid position they get.
If google needs 10 minutes, too, then you could do nothing on that phone, except to expose it to good view to sky.
(Inside an urban canyon it's more difficult to obtain a valid first fix, then on an big place.)

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