Class 15-maps.pdf - Using Location and Map APIs What and why Use Maps to display locations GPS to sense current location(LocationManger class in

Class 15-maps.pdf - Using Location and Map APIs What and...

This preview shows page 1 - 11 out of 68 pages.

Using Location and Map APIs
Background image
What and whyUse Maps to display locationsGPS to sense current location (LocationManger class in Android)sGeocoding = translation from and to addresses and latitude, longitude
Background image
GOOGLE Maps in transitionThere is a v1 and v2 Google Maps API.Use the later version Warning depending on version of emulator it may not support v2 yet test on device
Background image
Incorporating Android Location APIsThe Android location APIs are built directly into the Android SDK.Until Google Play services introduced the new Google Location Services APIs, the android.locationpackage provided the sole means for working with the location features of a device.Even though the new Google location APIs are much more robust, here are some reasons why you should care about the Android location APIs:Not all devices are capable of having Google Play services installed.Therefore, it is impossible to access the Google location APIs on these devices.There are many classes available in the Android location APIs that are not available in the Google location APIs.This means that you are able to make use of the best of both APIs (provided they are both available), rather than relying on one over the other.
Background image
Google Maps API v2
Background image
Google Maps Android API v2Part of the Google Play services SDK, Use MapFragmentclassVersion 2 uses vector tiles. Their data representation is smaller, so maps appear in your apps faster, and use less bandwidth. For more: check MapboxCaching is improved, so users will typically see a map without empty areas. Maps are now 3D. You can change user perspective
Background image
PROBLEM: v2 is not supported on some Android Emulator Generally best to have a physical device to test.ALSO: devices not supporting OpenGL ES2.0 won't be able to run apps with maps (older devices)
Background image
Adding Map to Project1.Download and configure the Google Play servicesSDK. The Google Maps Android API is distributed as part of this SDK. 2.Obtain an API key. To do this, you will need to register a project in the Google APIs Console, and get a signing certificate for your app.3.Setup your Project to say it is using the GooglePlay Services4.Specify settingsin the Application Manifest. Add a map to a new or existing Android project.
Background image
App must ask for permissionsIn AndroidManifest.xml file (right after <manifest tag):<uses-permission android:name="android.permission.INTERNET"/><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/><!-- The following two permissions are not required to useGoogle Maps Android API v2, but are recommended. --><uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/><uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
Background image
Specify Use of OpenGLThe Google Maps Android API uses OpenGL ES version 2 to render the map. If OpenGL ES version 2 is not installed, your map will not appear.
Background image
Image of page 11

You've reached the end of your free preview.

Want to read all 68 pages?

  • Fall '12
  • JoshuaO'Connor
  • Google Maps, android location apis

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture