Geolocation and the use of Global Positioning System (GPS) allow developers to create dynamic real-time mapping, positioning, and tracking applications. Using the available geolocation methods, we can retrieve a detailed set of information and properties to create location-aware applications. We can obtain the user's location via the mobile data network, Wi-Fi, or directly from the satellite.
We will use the geolocation functionality from the geolocation plugin's API to monitor the feedback from the device and obtain the relevant location information, as follows:
First, create a new PhoneGap project named
geolocation
. Open Terminal or Command Prompt and run following command:phonegap create geolocation com.myapp.geolocation geolocation
Add the device platform. You can choose to use Android, iOS, or both:
cordova platform add ios cordova platform add android
Add the geolocation plugin by running the following command:
phonegap plugin...