Android application for gps

21
ANDROID MOBILE APPLICATION ON GOOGLE MAPS

description

how to get google maps in your application and important functions used to track and update your location (GPS)

Transcript of Android application for gps

Page 1: Android application for gps

ANDROID MOBILE APPLICATION ON GOOGLE MAPS

Page 2: Android application for gps

Objective:• Main objective is about getting updates on our current location using android application • Pinpointing the location • Getting the exact address along with the latitudes and longitudes of the location • Getting street view and satellite view of the required location.

Page 3: Android application for gps

Obtaining Google maps API key: To access the Google Maps servers with the Maps API, you have to add a Maps API key to our application. The key is free, you can use it with any of our applications that call the Maps API.

Installing Google maps on our application

Page 4: Android application for gps

• You obtain a Maps API key from the Google APIs Console by providing your application's signing certificate and its package name. • Once you have the key, you add it to your application by adding an element to your application's manifest fileAndroidManifest.xml.

Page 5: Android application for gps

< com.google.android.maps.MapView android:layout_width = "fill_parent" android:layout_height= "fill_parent" android:apiKey="0usa-pB5DrxYwUz_6VusUTuqoYml5uOOjtLrQDA" />

Fingerprint:E6:0C:01:2D:6A:92:60:4B:4B:5C:63:2E:BB:21:AD:58

Page 6: Android application for gps

Obtaining the fingerprint: Keytool –list –alias –androiddebugkey –

keystore/C:\Users\Sutej\Contacts\.android\debug.keystore –storepass android –keypass android

Page 7: Android application for gps

Debug certificate: The Android SDK tools generate this certificate automatically when you do a "debug" build from the command line,

The certificate is only for use with an application that you're testing; you can't publish an app that's signed with a debug certificate.

You can generate an API key from this certificate, but only use the key for testing, never for production.

Page 8: Android application for gps

Some of the important functions used in java file are:

SetContentView: This is the method used to connect XML file to JAVA file.

FindViewById: This is the method used to access button created in XML file in java file.

OnClickListener: to give action to the button. INTENT: this is used to start another activity.

Page 9: Android application for gps

GeoPoint: A class representing a pair of latitude and longitude, stored as integer numbers of microdegrees.

MapView: A View which displays a map (with data obtained from the Google Maps service). It will capture keypresses and touch gestures to pan and zoom the map. It can also be controlled programmatically (getController ()) and can draw a number of Overlays on top of the map (getOverlays ()).In order to display Google Maps data in a MapView; you must register with the Google Maps service and obtain a Maps API Key.

Page 10: Android application for gps

MyLocationOverlay: An Overlay for drawing the user's current location (and accuracy) on the map.

MapController: A utility class to manage panning and zooming of a map.

Page 11: Android application for gps

For Updating location: Voidandroid.location.LocationManager.requestLocationUpdates (String provider, long minTime, float minDistance, LocationListener listener)

Page 12: Android application for gps

PARAMETERS:* provider: the name of the provider with which to register minTime: minimum time interval between

location updates, in milliseconds minDistance: minimum distance between

location updates, in meters

Page 13: Android application for gps

Navigation of our application: Press the map more than 3 sec we will see

three buttons Place a pin point: it marks the current

location Toggle view: it changes street view to

satellite view and vice versa. Get address: it shows the address of the

current location.

Page 14: Android application for gps
Page 15: Android application for gps
Page 16: Android application for gps
Page 17: Android application for gps

Permissions: For our project we need to take several permissions to make sure our application works fine. <uses-permission android:name="android.permission.INTERNET"/> <uses-permission

android:name="android.permission.ACCESS_FINE_LOCATION"/>

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> 

Page 18: Android application for gps

Running this application in normal AVD emulator wont work we have to select the target device as Google APIs.

Emulator used to run this application

Page 19: Android application for gps

Security: Android applications run in a sandbox, an isolated area of the system that does not have access to the rest of the system's resources. The Android Application Sandbox, which isolates your app data and code execution from other apps.

Page 20: Android application for gps

Release certificate: The Android SDK tools generate this certificate when you do a "release" build with either any program or Eclipse.

This certificate can be used with an app you release to the world.

Page 21: Android application for gps

Thank You