6

Is there any way to determine if a user is indoor or outdoor? I'm not interested in indoor mapping, just if the user is indoor or not without asking the user.

If the user is using Wifi then maybe the user is indoor or if the user is standing on the road for example.

Michael Dorner
  • 17,587
  • 13
  • 87
  • 117
willi
  • 6,559
  • 4
  • 30
  • 27
  • 2
    Use the camera to see how bright it is? Listen for wind and traffic noise? – Hot Licks Dec 02 '12 at 14:18
  • Still wouldn't be 100% fool proof, but if only the ambient light sensor could distinguish between florescent and UV light... – Mick MacCallum Dec 02 '12 at 15:05
  • sun is much brighter than the brigthrst indoor light. remember indoor fotography without flash, (difficult) outdoors on day it is always bright enough – AlexWien Dec 02 '12 at 15:40
  • Thanks for your suggestions. I know there is no API for it. I want to hear your creative suggestions for it. I know it won't be accurate. Also it's not necessary during night or day, so measure brightness won't help. – willi Dec 02 '12 at 15:57

7 Answers7

4

There is no way you can know 100% sure. Generally, the GPS signal would be weaker indoor, but not always. Also, the fact that the user coordinates are on a road tells you nothing, he could be indoor and the signal strength could be week and the coordinates flawed. However, depending on how accurate you want your algorithm to be, you could rely on the signal strength ( and maybe position ) to give you something.

If you want to take it to the next level, although it could prove to be a waste of time, given the fact that the user usually has movement patterns (home to work, work to shop, Sunday in the park, etc) you could try the above, plus several other parameters like a pedometer (moving, walking, running), speed (high speed, no movement from the pedometer, means he's in a car), noise, brightness etc. and run a logistic regression algorithm maybe asking for user feedback as training set. However, as you can see, this would become pretty large, and definitely not worth it if your app is small.

Rad'Val
  • 8,895
  • 9
  • 62
  • 92
1

No, there is no API to check for that. Looking at things like Wifi won't help you either, because it's possible that the user uses a mobile hotspot and is currently standing on a field. I'm afraid that you have to ask the user wether they are indoors or outdoors, however, are you sure that you are solving the right problem here?

JustSid
  • 25,168
  • 7
  • 79
  • 97
1

You wouldn't be able to definitively state whether or not the user is inside or outside (and WIFI vs. Cellular wouldn't help... you can use WIFI when outside and cellular when inside). I think the closest you could get (and even this has too many variances to be trustworthy) is to note changes in GPS signal strength (horizontalAccuracy, verticalAccuracy, etc.).

Bottom line is that there isn't a programmatic way to check this.

J Shapiro
  • 3,861
  • 1
  • 19
  • 29
1

It seems that any single sensor based approach does not solve the problem. A research work tackled your problem with combining all the mentioned techniques in this thread.

Pengfei Zhou et al.[1], proposed IODetector('Indoor/Outdoor Detector'), a sensing service that detects indoor/outdoor environment. It uses various sensors including accelerometer, proximity sensor, light sensor, magnetometer. It also observes celltower signals. According to their experiment, detection performance of the system(precision/recall) is about 85%.

1 Pengfei Zhou, Yuanqing Zheng, Zhenjiang Li, Mo Li, and Guobin Shen. 2012. IODetector: a generic service for indoor outdoor detection. In Proceedings of the 10th ACM Conference on Embedded Network Sensor Systems (SenSys '12), 113-126.8

Wonjung Kim
  • 1,873
  • 15
  • 18
0

Did you use Reachablitiy class to determine if the user is using WiFi or way of internet connection? Please check the sample here.

Paramasivan Samuttiram
  • 3,728
  • 1
  • 24
  • 28
0

using the number of visible GPS sattelites is one indicatot, on ios you cannot get that attribute.
Gps signal strength measzred in dB is a further indicator, but not available in ios Api.
the next is the hdop value, on ios not available, too.
What remains is the horicintal Accuracy, which i somehow a combination of the above.

Other simple solutions:
outdoors people are usually moving: check speed of GPS
Complex solution probabky out if your scope: digital road maps built for navi and other applications have the coordinates of inner city houses stored (not all cities), you could check if pos is within such a polygon combined with accuracy value.

i estimate that it is possible to do your task with rhevsimple solution, such that you get 90 - 95% corret detection rate

AlexWien
  • 28,470
  • 6
  • 53
  • 83
0

As far as I know there is one useful API (also possible to run in the background): CMMotionActivityManager from the CoreMotion framework. It provides a CMMotionActivity with some motion activities such as automotive or cycling. Depending on your point of view you could define car as outdoor (or indoor).

It is also not very likely that you are cycling indoor. But keep in mind that cycling is not really working, although it is part of the API.

Community
  • 1
  • 1
Michael Dorner
  • 17,587
  • 13
  • 87
  • 117