ICP 5 - Gnkhakimova/CS5551 GitHub Wiki
ICP 5
Current location
Objectives
The purpose of this project was to display current location using Google Play Services - Google maps. Current location of the device needs to be displayed on the map using marker. GPS_provider
was user in order to get longitude and latitude of location. Need to set permissions to use Internet, Location etc.
Steps
On the main page user can click on "Display location" button which takes the user to google maps and shows current location of the device with marker. When marker is clicked "I am here" sign is shown above marker.
Google maps with current location of the user
For marker I user icon, if icon is clicked sign is displayed above it
Source Code
Need to create Google API key to use Google maps. Which is stored in manifest. In order for application to work we need to set permissions to use camera, internet and location.
Declaring variables for application
OnCreate
function sets up Location manager which will help us to get our current location.
Calling GPS_provider in order to get longitude and latitude of current location using getLastKnowLocation
which return long and lat of the device.
Adding marker on the map with current location by passing longitude and latitude from previous call and displaying popUp on marker click which the sign "I am here".