I don't believe there is any RELIABLE way of doing this.
Consider the problems:
-
what are the dimensions of a typical room? Perhaps 3 x 4 meters? On a good day the typical gps hardware receiver can at BEST resolve about 2 meters (typically about 4 to 10 meters).
-
if your room has only small windows your Android will have difficulty receiving the minimum of three gps satellite transmissions to get a satellite location fix. You gps works best outside where the Android gps has unobscured view of the sky where the satellites are continually roaming. Professionals that attempt using gps for identification of locations within a building typically use AGPS (augmented gps) to do it. Definitely beyond the capabilities of the existing LocationSensor App Inventor uses.
-
there are many more obsticales to achieving your goal when using simple coding and App Inventor.
What can you do?
-
establish a ringed fence for each of your rooms. Use it and the gps coordinates to determine which room is associated with the set of provided coordinates. A simple ringed fence is described in Figure 18-12 of Programming Your App to Make Decisions http://www.appinventor.org/bookChapters/chapter18.pdf
-
Make a Map Polygon for each room you want to resolve. The Map component has a way to determine if the location coordinates provided by your gps are within or outside the polygon boundaries. Use your app to determine if the Android is within any of your polygons.
The bad news is you still have the 'resolution' problem (the gps still doesn't know exactly where it id; read about Accuracy).
- Instead of individual polygons, create a FeatureCollection of polygons. Here are several articles you might find useful if you attempt to see if you are in a room (other than opening your eyes and looking at the room).
Resources:
You can try lots of things. Several others have made some proposals and one of them might work for you. ![]()