Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I detect if an Android device is indoor/outdoor?

I'm developing an app which fuses location from various providers, hoping it will give a more accurate location than if I simply used the Google API. However, the choice of providers would depend on the phone being indoor or outdoor (Network vs GPS, for example).

What is the best way to detect if the device is indoor or outdoor? My first thought would be using the Light sensor, and maybe cell signal strength and WiFi (if there are WiFi networks near, it's likely the device is indoor), but I don't know which weight/confidence I should attribute to these sensors.

Edit: this is for my masters thesis, in which the goal is to get the location from the different providers (GPS, Network and Passive) in the Android API, and fuse them with a formula. Depending on whether the phone is indoor or outdoor, the several locations would have different weights. There would also be parameters like if battery life is priority or not (I haven't developed this formula yet).

like image 232
user1025725 Avatar asked Apr 16 '14 14:04

user1025725


1 Answers

Just subscribe to both providers and use location.getProvider() and location.getAccuracy() when new location arrives--to check if it's more/less accurate then previous.

like image 181
Alex Salauyou Avatar answered Sep 24 '22 16:09

Alex Salauyou