Without geography, you’re nowhere.
The ability to locate exactly where you are on Earth via consumer products has become commonplace, yet the technology is empowering. If you own a GPS-capable cellular phone, you have this technology at your fingertips.
In this chapter, we will discuss the geolocation API for accessing location information from an Android device.
flash.events.GeolocationEvent class is a new
object that contains updated geolocation information. The new
flash.sensors.Geolocation class is a subclass of
EventDispatcher class. It listens
for and receives information from the device’s location sensor in the
form of a
To use the geolocation classes, first you must add the necessary
permissions. In Flash Professional, enable
ACCESS_COARSE_LOCATION device permissions
under File→AIR Android Settings→Permissions. In Flash Builder, select
under Mobile Settings→Permissions. To
make changes, append your application manifest file as follows:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Fine location refers to GPS communication, while coarse location refers to network communication. I will explain the difference between the two later in this chapter.
If your location permissions are not set up, your application will fail ...