This tutorial introduces location services features available in App Inventor.
A future tutorial will demonstrate these features applied to specific applications.
About Android Device Location and GPS Features
Your Android device probably has built-in features to identify the device’s location. These features may include:
- Global Positioning Satellite receiver (GPS)
- Cellular network location information
- Wi-Fi network location information
The GPS receiver interprets special (and very weak!) timing signals from satellites and uses those signals to compute latitude, longitude and altitude of your device. GPS has fairly good accuracy – correctly identifying the device’s position within as little as 5 meters (but which may at times be much wider such as within a 30 meter diameter circle accuracy). GPS accuracy is affected by the device’s ability to see the sky and may be blocked by buildings, trees and weather, and signals may suffer from ionospheric effects.
Cell phones can obtain information about the cellular network tower to which they are connected, including location information from the cellular tower.
Wi-Fi networks have a unique identifier associated with them (not the SSID public address). Google has built a map of wi-fi access point network locations using a combination of their Google mapping cars as well as everyone’s Android-powered cellular phone to build a huge database of wi-fi access points and their location. Your Android device can use a combination of location data and fetch a postal mailing address from Google for a given location.
Android phones have options as to which type of location information to use.
- Cellular network information may be the least accurate, but it also uses the least amount of battery power.
- Wi-fi network position information also uses little battery power, and can provide reasonably accurate location information when your phone is indoors and unable to hear signals from GPS satellites.
- GPS provides the best accuracy but receiving and processing the signals uses the most battery power.
Your Android phone has options to select High accuracy, Battery saving and Device only.
- High accuracy – Android will automatically select GPS, cellular or wi-fi to obtain a high accuracy position reading. This is likely the default setting on your phone.
- Battery saving – Android will use cellular or Wi-fi networks to obtain position information.
- Device only – Android will use the GPS receiver (greatest battery drain)
To select Location services, go to Settings | Location and set this feature to “On”.
Touch the item labeled “Mode” at the top of the screen to select “Location mode” options. This is where you may choose High accuracy, Battery saving or Device only.
MIT App Inventor has a component named LocationSensor providing access to latitude, longitude, altitude and even the postal mailing address associated with the location.
This tutorial introduces the LocationSensor and the basic properties and features. A future tutorial will go in to more depth.