HERE SDK for Android. Developer's Guide. Online Version 2.1
|
|
|
- Lindsay Daniel
- 10 years ago
- Views:
Transcription
1 HERE SDK for Android Developer's Guide Online Version 2.1
2 Contents 2 Contents Legal Notices.4 Document Information 5 Service Support. 6 Chapter1:Overview 7 What is the HERE SDK for Android?..8 Feature List 8 Chapter2:Quick Start 10 Creating a Simple Application. 11 Extending the Application.. 16 Adding Route Calculation 20 Chapter3:User Guide. 24 Authenticating Applications.. 25 Obfuscating Applications.25 Maps..26 Gestures 32 Map Schemes 35 MapEngine Class. 39 Objects and Interaction 40 Transit. 51 Positioning.. 62 MapActivity Class.. 66 Extruded Buildings 67 3D Landmarks.. 72 Custom Raster Tiles 72 Places75
3 Contents 3 Geocoding and Reverse Geocoding 76 Search and Discovery 78 Directions. 83 Calculate routes. 84 Chapter4:Supplemental Information 89 Creating a Simple HERE SDK Application in Android Studio90 Compatibility Fragments. 96 Size Management.. 96 Development Tips. 98 Chapter5:API Reference.. 99
4 Legal Notices 4 Legal Notices 2014 HERE. All rights reserved. This material, including documentation and any related computer programs, is protected by copyright controlled by HERE. All rights are reserved. Copying, including reproducing, storing, adapting or translating, any or all of this material requires the prior written consent of HERE. This material also contains confidential information, which may not be disclosed to others without the prior written consent of HERE. Trademark Acknowledgements HERE and Nokia are trademarks or registered trademarks of Nokia Corporation in the United States and other countries. Other trade names are trademarks or registered trademarks of their owners. Disclaimer This content is provided "as-is" and without warranties of any kind, either express or implied, including, but not limited to, the implied warranties of merchantability, fitness for a particular purpose, satisfactory quality and non-infringement. Nokia does not warrant that the content is error free and Nokia does not warrant or make any representations regarding the quality, correctness, accuracy, or reliability of the content. You should therefore verify any information contained in the content before acting on it. To the furthest extent permitted by law, under no circumstances, including without limitation Nokia's negligence, shall Nokia be liable for any damages, including, without limitation, direct, special, indirect, punitive, consequential, exemplary and/ or incidental damages that result from the use or application of this content, even if Nokia or an authorized representative has been advised of the possibility of such damages.
5 Document Information Document Information Product Name: HERE SDK for Android Version: Online Version 2.1 Document Name: Id: 63abd Status: DRAFT Date: 2014-Dec-05, 16:11 (GMT) 5
6 Service Support Service Support If you need assistance with this or other HERE products, please contact your HERE representative or Technical Customer Support via at 6
7 Overview Chapter 1 Overview Topics: What is the HERE SDK for Android? The articles that follow introduce the HERE SDK for Android, explain essential concepts and describe the common features it Feature List supports. 7
8 Overview 8 What is the HERE SDK for Android? The HERE SDK for Android provides a set of programming interfaces that enable developers to build immersive, geographically-aware Android applications by leveraging a powerful and flexible mapping platform. Through this SDK, developers can add rich location features such as routing, interactive maps, and global place search to their applications. The powerful client-side HERE SDK for Android also includes a sophisticated engine for rendering map data and calculated routes. In addition to dynamically downloading map data, the SDK also supports offline maps using previously cached map data or downloaded map packages. Vector Maps The HERE SDK delivers vector-based map data, in contrast to most mapping SDKs that only provide APIs to display map data using raster tiles. With raster tiles, panning to a new location or moving to a new zoom level requires additional raster tiles must be downloaded, leading to a negative impact on application fluidity and the overall user experience. Vector map data used by the HERE SDK consists of many data layers that are rendered based on rules describing what to display and how to display it. This enables use cases typically not possible with raster tiles, such as: dynamically altering the look and style of the map (for example: changing to night mode) without downloading new map data zooming the map smoothly rather than in discrete zoom steps rotating the map while maintaining correct label and icon orientation tilting the map to show textured 3D landmarks Moreover, vector map data requires significantly less storage space than raster map tiles, enabling map data to be downloaded for offline use. The result is a powerful hybrid solution where map data can be downloaded over a wireless data connection as needed, or maps for countries and regions can be preloaded for later use, eliminating the need for an always-present wireless data connection. The HERE SDK uses vector data for all normal maps. Raster tiles are used when satellite, terrain, and custom maps are being displayed. Feature List The main features offered by the HERE SDK for Android are listed below:
9 Overview Mapping Dynamically download vector maps for more than 190 countries in over 50 languages Map styles: normal street map, satellite map, transit map, and more Textured 3D landmarks Touch gestures (including pan, flick, pinch zoom, rotate, and tilt) Overlay objects on the map such as polylines, polygons, icons, and routes Overlay 3D map objects Overlay custom raster tiles on the map (for example, to display heat maps) Ability to render raster tiles and map objects interleaved within different map layers 3D Extruded Buildings 3D Landmarks Transit object interaction Search Search through a broad set of geographical content, including 25 million streets, 200 million address points, and over 60 million categorized places across the globe Search for a specific place or explore by categories Get rich details for a Point of Interest (including images, ratings, reviews, and editorials) Perform geocoding and reverse geocoding lookups Directions Get driving or pedestrian directions Specify preferred route type (fastest/shortest) and attributes to avoid (toll roads, motorways, parks, and more) Alternate routes 9
10 Quick Start Chapter 2 Quick Start Topics: Creating a Simple Application Using the HERE SDK Extending the Simple Application Adding Route Calculation to the Simple Application The articles in this section provide information to help you start using the HERE SDK for Android. 10
11 Quick Start 11 Creating a Simple Application Using the HERE SDK This tutorial provides instructions on how to create a simple application that uses the HERE SDK for Android to render a map on an Android device. With this application, users will be able to: Pan around the map to view different geographical regions Center the map on a specific part of the viewable area using standard Android single-tap gestures Zoom in and out using standard Android pinch-to-zoom, double-tap, or two-finger tap Rotate the map using standard Android two-finger rotate gestures Tilt the map using standard Android two-finger tilt gestures Note: This tutorial applies to Eclipse and Android Developer Tools. For information on how to perform the same tasks in Android Studio, refer to Creating a Simple HERE SDK Application in Android Studio on page 90. Development tasks for this basic application include: Create a new Eclipse project Add necessary resources, permissions and map fragment(s) to the project properties and application manifest Acquire credentials from HERE for accessing map services Initialize the map fragment such that a map instance is created and associated with the map fragment for rendering on the client device Create a New Eclipse Project The first stage of developing an application using the HERE SDK is to create a new project in Eclipse as follows: 1. From the Eclipse File menu, select New> Android Application Project to open the New Android App dialog (or click from the toolbar) 2. In the New Android Application dialogue, under Application Name, specify an appropriate application name (The remainder of this tutorial will refer the application name as HelloHEREMaps) 3. Under Project Name, specify an appropriate project name 4. Under Package Name, specify an appropriate package name (For example, com.mapstutorial.helloheremaps. This is the package name that this tutorial will use)
12 Quick Start Under Minimum Required SDK, select the lowest version of the Android SDK you wish to support. For this sample application, we will use Android Under Target SDK, select your target Android SDK version with API level 14 (Ice Cream Sandwich 4.0.1) or above 7. Click Next 8. Click Next to use the default icons 9. On the Create Activity dialog box, select Blank Activity and click Next 10. Click Finish Result: A new project will appear within the Eclipse Package Explorer, which will expand to show the location of the activity_main.xml file. The file itself will be opened in the main editor view, in Graphical Layout mode for adding and editing UI elements. Add HERE SDK Libraries to Your Project After creating the skeleton of your new application, add the HERE SDK resources as follows: 1. From the directory where you installed the HERE SDK, copy the contents of the HERE-sdk/libs/ folder, except HERE-sdk-javadoc.jar, to your project's libs/ folder. 2. In your Eclipse project's libs/ folder, right-click the HERE-sdk.jar file and select Build Path> Add to Build Path. 3. Optional: If you plan on extending this application with HERE Places functionality, add the googlegson library (release or a compatible version) into your project. One way to do this is to download the google-gson-*-release.zip file from unzip the ZIP archive, and copy the gson-*.jar (not gson-*-sources.jar or gson*-javadoc.jar) into your project libs/ folder, then right-click on it in Eclipse, and select Build Path> Add to Build Path. The google-gson library is required for all HERE Places operations. For more information on using HERE Places, please see Places on page 75. Result: Your project will be able to make use of APIs from the HERE SDK. Note: Performing these steps should also link Javadoc files to the SDK library. If Javadoc does not appear in Eclipse, please close and re-open your Eclipse project. If you would like to change the location of the docs folder, update thehere-sdk.jar.properties file in the libs folder to match the docs folder location. Edit AndroidManifest.xml With resources added to your project, the next stage of creating an application with the HERE SDK is to edit the project's AndroidManifest.xml file to specify Android permissions as follows: 1. From the Package Explorer, double-click your project's AndroidManifest.xml file to open it for editing. 2. At the bottom of the editor view that displays the manifest, click the AndroidManifest.xml tab to switch the file's view to text editor mode.
13 Quick Start Add the following markup beneath the <uses-sdk/> tag: <uses-permission android:name="android.permission.access_fine_location"/> <uses-permission android:name="android.permission.write_external_storage"/> <uses-permission android:name="android.permission.access_network_state"/> <uses-permission android:name="android.permission.change_network_state"/> <uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.access_wifi_state"/> 4. Within the <application></application> block of tags, add the following markup directly beneath the <activity></activity> tag: <meta-data android:name="com.here.android.maps.appid" android:value="your APP ID"/> <meta-data android:name="com.here.android.maps.apptoken" android:value="your APP CODE"/> 5. Replace the YOUR APP ID and YOUR APP CODE strings with appropriate credentials for your application, which you can acquire by contacting your HERE account representative. Note: All users of the HERE SDK are required to register for a HERE App_Id and App_Code, and to specify those values in their Android manifest XML file. Failure to do so will result in blocked access to certain features and could lead to degradation in the quality of other services. 6. Within the same <application></application> section in your AndroidManifest.xml file, add the following lines: <service android:name="com.here.android.mpa.service.mapservice" android:label="heremapservice" android:process="global.here.map.service.v2" android:exported="true" > <intent-filter> <action android:name="com.here.android.mpa.service.mapservice" > </action> </intent-filter> </service> Result: Your application is now configured to use the minimum Android device permissions that are required by HERE Maps
14 Quick Start 14 Edit activity_main.xml Along with permissions and credentials, you must add an Android <fragment /> tag to set up the map fragment that your application activity will be associated with. In this section, we will display a text label (generated as part of the default new application) and a map right below label as follows: 1. From the Package Explorer, under the res/layout/ folder of your project, double-click the activity_main.xml file to open it for editing. 2. At the bottom of the editor view that displays the layout for MainActivity, click the activity_main.xml tab to switch the file's view to text editor mode. 3. Ensure that the XML file has <LinearLayout></LinearLayout> as its root element. Depending on your version of Eclipse, this may be a RelativeLayout instead. If that is the case, replace the contents of the file with the following: <LinearLayout xmlns:android=" xmlns:tools=" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" tools:context=".mainactivity" /> </LinearLayout> 4. Add the following markup beneath the <TextView/> tag: <!-- Map Fragment embedded with the map object --> <fragment class="com.here.android.mpa.mapping.mapfragment" android:id="@+id/mapfragment" android:layout_width="match_parent" android:layout_height="match_parent"/> Result: When MapFragment is initialized, your application's MainActivity will contain a MapFragment UI element (with the ID mapfragment) that owns a Map object. Initializing the Map Fragment When you have defined the basic layout of the application and acquired necessary permissions, the final step is to initialize the instance of the MapFragment class, thus creating and associating a Map with the MapFragment declared in the activity_main.xml file: From the Package Explorer, under the src/ folder of your project, double-click the MainActivity.java file to open it for editing.
15 Quick Start 15 Revise the import statements and functional logic of the MainActivity to look like the following: package com.mapstutorial.helloheremaps; import android.app.activity; import android.os.bundle; import import import import com.here.android.mpa.common.geocoordinate; com.here.android.mpa.common.onengineinitlistener; com.here.android.mpa.mapping.map; com.here.android.mpa.mapping.mapfragment; public class MainActivity extends Activity { // map embedded in the map fragment private Map map = null; // map fragment embedded in this activity private MapFragment mapfragment = null; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // Search for the map fragment to finish setup by calling init(). mapfragment = (MapFragment)getFragmentManager().findFragmentById( R.id.mapfragment); mapfragment.init(new OnEngineInitListener() { public void onengineinitializationcompleted( OnEngineInitListener.Error error) { if (error == OnEngineInitListener.Error.NONE) { // retrieve a reference of the map from the map fragment map = mapfragment.getmap(); // Set the map center to the Vancouver region (no animation) map.setcenter(new GeoCoordinate( , , 0.0), Map.Animation.NONE); // Set the zoom level to the average between min and max map.setzoomlevel( (map.getmaxzoomlevel() + map.getminzoomlevel()) / 2); else { System.out.println("ERROR: Cannot initialize Map Fragment"); ); Result: You can run your simple application by pressing the key combination Ctrl + F11 from within Eclipse (if prompted, run the project as an "Android Application"). The application will render a map retrieved from the HERE servers. When you are running your application on a device, make sure a dataconnection is enabled. See folder BasicMapSolution for a completed example. You will need to add your own App_Id and App_Code for this completed example to work.
16 Quick Start 16 Extending the Simple Application Beyond creating a basic application, you can extend your application with the use of features from the HERE SDK for Android. This tutorial introduces methods to change map attributes such as map center, tilt angle, orientation, daytime/nighttime map schemes, and zoom levels. Getting Started You can import the Android project from the BasicMapSolution folder as a starting point for this exercise. (Please note that MainActivity is changed to BasicMapActivity in this version of the project.) Note: The tasks presented on this page assume that you gave the name "HelloHEREMaps" to your Eclipse project and the name com.mapstutorial.helloheremaps to your application package. Add a "Go Home" Button This task introduces the following HERE SDK for Android class methods: com.here.android.mpa.mapping.map.setorientation() com.here.android.mpa.mapping.map.settilt() Within a map-based application, users can pan around the map to different regions, zoom in and out, even rotate or tilt the map itself. A user-friendly app might, in turn, offer users a UI element that allows them to reset the initial map view. Add a "Go Home" Button element to the HelloHEREMaps application as follows: 1. From the Package Explorer, double-click the HelloHEREMaps/res/values/strings.xml file to open it for editing. 2. At the bottom of the editor view that displays the string resources, click the strings.xml tab to switch the file's view to text editor mode. 3. Add the following line to the group of <string></string> tags: <string name="label_button_gohome">go Home</string> 4. From the Package Explorer, double-click the HelloHEREMaps/res/layout/activity_main.xml file to open it for editing.
17 Quick Start Add the following markup directly above the <fragment /> tag: <!-- UI element declaration for "Go Home" button --> <android.widget.button android:layout_width="wrap_content" android:layout_height="wrap_content" android:onclick="gohome" /> 6. From the Package Explorer, double-click the HelloHEREMaps/src/ com.mapstutorial.helloheremaps/mainactivity.java file to open it for editing. 7. Add the following lines to the import statements near the top of the source file: import android.view.view; import java.util.list; 8. Add the following method to the end of the class: // Functionality for taps of the "Go Home" button public void gohome(view view) { if (map!= null) { // Change map view to "home" coordinate and zoom level, plus // eliminate any rotation or tilt map.setcenter(new GeoCoordinate( , , 0.0), Map.Animation.NONE); map.setzoomlevel((map.getmaxzoomlevel() + map.getminzoomlevel()) / 2); map.setorientation(0); map.settilt(0); // Reset the map scheme to the initial scheme map.setmapscheme(initial_scheme); 9. Press the key combination Ctrl + F11 within Eclipse to run this extended basic HERE SDK for Android application. Result: Your HERE SDK for Android application displays a map centered initially on the Vancouver municipal region, plus a "Go Home" button near the top-left corner that allows users to reset the map to its initial view. Add a "Change Map Scheme" Button This task introduces the following HERE SDK for Android class methods: com.here.android.mpa.mapping.map.getmapscheme() com.here.android.mpa.mapping.map.getmapschemes() com.here.android.mpa.mapping.map.setmapscheme()
18 Quick Start 18 There are numerous map schemes available from HERE SDK for Android. You can add a UI element to your application that allows users to change the scheme of the map they are viewing. Add a "Change Map Scheme" Button element to the HelloHEREMaps application as follows: 1. From the Package Explorer, double-click the HelloHEREMaps/res/values/strings.xml file to open it for editing. 2. Add the following lines to the group of <string></string> tags: <string name="label_button_changescheme">change Map Scheme</string> 3. From the Package Explorer, double-click the HelloHEREMaps/res/layout/activity_main.xml file to open it for editing. 4. Add the following markup directly beneath the homebutton tag but above the <fragment /> tag: <!-- UI element declaration for "Change Map Scheme" button --> <android.widget.button android:id="@+id/schemebutton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/label_button_changescheme" android:onclick="changescheme" /> 5. From the Package Explorer, double-click the HelloHEREMaps/src/ com.mapstutorial.helloheremaps/mainactivity.java file to open it for editing. 6. Add the following to the import statements near the top of the source file: import java.util.list; 7. Add variable declarations for initial_scheme to the top of the MainActivity class, immediately beneath the declaration for map, as follows: public class MainActivity extends Activity { // map embedded in the map fragment private Map map = null; // map fragment embedded in this activity private MapFragment mapfragment = null; // Initial map scheme, initialized in oncreate() and accessed in gohome() private static String initial_scheme = ""; public void oncreate(bundle savedinstancestate) {
19 Quick Start Create function private void onmapfragmentinitializationcompleted() and move all the existing text within OnEngineInitListener's onengineinitializationcompleted() into it: private void onmapfragmentinitializationcompleted() { // retrieve a reference of the map from the map fragment map = mapfragment.getmap(); // Set the map center coordinate to the Vancouver region (no animation) map.setcenter(new GeoCoordinate( , , 0.0), Map.Animation.NONE); // Set the map zoom level to the average between min and max (no // animation) map.setzoomlevel((map.getmaxzoomlevel() + map.getminzoomlevel()) / 2); 9. Update the OnEngineInitListener's onengineinitializationcompleted() implementation as follows: mapfragment.init(new OnEngineInitListener() { public void onengineinitializationcompleted(onengineinitlistener.error error) { if (error == OnEngineInitListener.Error.NONE) { onmapfragmentinitializationcompleted(); 10. Add the following method to the end of the class: // Functionality for taps of the "Change Map Scheme" button public void changescheme(view view) { if (map!= null) { // Local variable representing the current map scheme String current = map.getmapscheme(); // Local array containing string values of available map schemes List<String> schemes = map.getmapschemes(); // Local variable representing the number of available map schemes int total = map.getmapschemes().size(); if (initial_scheme.isempty()) { //save the initial scheme initial_scheme = current; // If the current scheme is the last element in the array, reset to // the scheme at array index 0 if (schemes.get(total - 1).equals(current)) map.setmapscheme(schemes.get(0)); else { // If the current scheme is any other element, set to the next // scheme in the array for (int count = 0; count < total - 1; count++) { if (schemes.get(count).equals(current)) map.setmapscheme(schemes.get(count + 1));
20 Quick Start To ensure that a tap of the "Go Home" button resets the map scheme while it is resetting everything else (coordinates, zoom level, etc.), add the following lines to the end of the gohome() method: // Reset the map scheme to the initial scheme if (!initial_scheme.isempty()) { map.setmapscheme(initial_scheme); 12. Press the key combination Ctrl + F11 within Eclipse to run this extended basic HERE SDK for Android application. Result: Your HERE SDK for Android application displays a map centered initially on the Vancouver municipal region, plus a "Go Home" button near the top-left corner that allows users to reset the map to its initial view, followed by a "Change Map Scheme" button that allows users to cycle through available map schemes. See folder ExtendedBasicMapSolution for a completed example. You will need to add your own App_Id and App_Code for this completed example to work. Adding Route Calculation to the Simple Application An important feature of many map-based applications is offering directions to users by calculating a route that can be rendered on the map. This tutorial lesson introduces the addition of such functionality to applications developed using the HERE SDK for Android. Getting Started You can import the Android project from the BasicMapSolution folder as a starting point for this exercise. (Please note that MainActivity is changed to BasicMapActivity in this version of the project.) Note: The tasks presented on this page assume that you gave the name "HelloHEREMaps" to your Eclipse project and the name com.mapstutorial.helloheremaps to your application package. Add a "Get Directions" Button Add a "Get Directions" Button element to the HelloHEREMaps application as follows: 1. From the Package Explorer, double-click the HelloHEREMaps/res/values/strings.xml file to open it for editing.
21 Quick Start Add the following lines to the existing group of strings <string name="label_button_getdirections"> Get Directions </string> <string name="textview_routecoordinates_2waypoints"> Press "Get Directions" button to calculate a route:\nstart: Nokia, Burnaby\nEnd: Airport, YVR </string> 3. From the Package Explorer, double-click the HelloHEREMaps/res/layout/activity_main.xml file to open it for editing. 4. Add the following markup directly beneath the LinearLayout tag: <!-- UI element declaration for "Get Directions" button --> <android.widget.button android:id="@+id/directionsbutton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/label_button_getdirections" android:onclick="getdirections" /> 5. Next, change the <TextView/> tag to the following: <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/textview_routecoordinates_2waypoints" tools:context=".mainactivity" /> 6. From the Package Explorer, double-click the HelloHEREMaps/src/ com.mapstutorial.helloheremaps/mainactivity.java file to open it for editing. 7. Add the following lines to the import statements near the top of the source file: import import import import import import import import import import 8. java.util.enumset; java.util.list; android.view.view; android.widget.textview; com.here.android.mpa.common.geoboundingbox; com.here.android.mpa.mapping.maproute; com.here.android.mpa.routing.routemanager; com.here.android.mpa.routing.routeoptions; com.here.android.mpa.routing.routeplan; com.here.android.mpa.routing.routeresult; Add the declaration of these private member variables above the oncreate function: // TextView for displaying the current map scheme private TextView textviewresult = null; // MapRoute for this activity private MapRoute maproute = null;
22 Quick Start 22 and to set up the member variables for use later, add these lines at the end of the oncreate function: textviewresult = (TextView) findviewbyid(r.id.title); textviewresult.settext(r.string.textview_routecoordinates_2waypoints); 9. Add code to handle the click of the "Get Directions" button at the end of the class: First, create an implementation of the RouteManagerEventListener: private RouteManager.Listener routemanagerlistener = new RouteManager.Listener() { public void oncalculateroutefinished(routemanager.error errorcode, List<RouteResult> result) { if (errorcode == RouteManager.Error.NONE && result.get(0).getroute()!= null) { // create a map route object and place it on the map maproute = new MapRoute(result.get(0).getRoute()); map.addmapobject(maproute); // Get the bounding box containing the route and zoom in GeoBoundingBox gbb = result.get(0).getroute().getboundingbox(); map.zoomto(gbb, Map.Animation.NONE, Map.MOVE_PRESERVE_ORIENTATION); textviewresult.settext( String.format("Route calculated with %d maneuvers.", result.get(0).getroute().getmaneuvers().size())); else { textviewresult.settext( String.format("Route calculation failed: %s", errorcode.tostring())); public void onprogress(int percentage) { textviewresult.settext( String.format(" %d percent done ", percentage)); ; Next, add the implementation of getdirections() below: // Functionality for taps of the "Get Directions" button public void getdirections(view view) { // 1. clear previous results textviewresult.settext(""); if (map!= null && maproute!= null) { map.removemapobject(maproute); maproute = null; // 2. Initialize RouteManager RouteManager routemanager = RouteManager.getInstance(); // 3. Select routing options via RoutingMode RoutePlan routeplan = new RoutePlan(); RouteOptions routeoptions = new RouteOptions(); routeoptions.settransportmode(routeoptions.transportmode.car); routeoptions.setroutetype(routeoptions.type.fastest); routeplan.setrouteoptions(routeoptions);
23 Quick Start 23 // 4. Select Waypoints for your routes // START: Nokia, Burnaby routeplan.addwaypoint(new GeoCoordinate( , )); // END: Airport, YVR routeplan.addwaypoint(new GeoCoordinate( , )); // 5. Retrieve Routing information via RouteManagerListener routemanager.calculateroute(routeplan, routemanagerlistener); ; 10. Save all files in the HelloHEREMaps project by selecting File> Save All or by pressing the key combination Shift + Ctrl + S (within Eclipse). 11. Press the key combination Ctrl + F11 within Eclipse to run this HERE SDK for Android application with route calculation functionality. Result: your HERE SDK for Android application displays a map centered initially on the Vancouver municipal region, with a "Get Directions" button and a text box reflecting current status. Tapping on the button will trigger a route calculation for the hard-coded set of waypoints between Burnaby and Airport, YVR and render, and have the route displayed on map if successful. See the SimpleRoutingSolution folder for a completed example. You will need to add your own App_Id and App_Code for this completed example to work.)
24 User Guide 24 Chapter 3 User Guide Topics: Authenticating Applications Obfuscating Applications Maps Places Directions The articles in this section provide a guide to using the HERE SDK for Android.
25 User Guide 25 Authenticating Applications All applications using the HERE SDK must have a valid App_Id and App_Code in the application. App_Id and App_Code are unique to an application name space. To obtain these credentials, please contact your HERE account representative. You can add the App_Id and App_Code as <meta-data/> attributes to the ApplicationManifest.xml file of your application as follows: 1. Open the Eclipse project that you created as one of the Quick Start Guide tasks. 2. From the Package Explorer, double-click your project's AndroidManifest.xml file to open it for editing (switch to text editor mode for the file). 3. Within the <application></application> block of tags, add the following markup: <meta-data android:name="com.here.android.maps.appid" android:value="your APP ID"/> <meta-data android:name="com.here.android.maps.apptoken" android:value="your APP CODE"/> 4. Replace the YOUR APP ID and YOUR APP CODE strings with appropriate credentials for your application. Obfuscating Applications If you would like to use ProGuard to obfuscate your application, you must add HERE SDK-specific options (in addition to your application options) to ensure that the HERE library is not further obfuscated. Typically, the ProGuard rules are specified through the proguard.config variable inside the project.properties file, similar to the following: proguard.config=${sdk.dir/tools/proguard/proguard-android.txt:proguardproject.txt To add the HERE SDK-specific options, include the ProGuard configuration file (proguard-heresdk.txt) that is in the HERE SDK package by appending the filename to the proguard.config variable. For example: proguard.config=${sdk.dir/tools/proguard/proguard-android.txt:proguardproject.txt:proguard-here-sdk.txt
26 User Guide 26 For more information on modifying your application's ProGuard configuration, refer to the ProGuard section of the Android Developer website. Maps The core feature of the HERE SDK for Android is Maps. The key concepts covered in this section include adding a map to the Android application, changing the location displayed by the map and its various properties. The classes covered include MapFragment and Map. MapFragment and Map are parts of a Model-View-Controller (MVC) pattern where the Model is the Map, and the View is the MapFragment. The MapFragment is a standard Android Fragment derived component. The developer can create a controller class to coordinate all interactions using custom logic. The first step to integrate a map into an application is to insert a MapFragment to the view layout of the application. This is accomplished by adding com.here.android.mpa.mapping.mapfragment to the Android XML layout file as follows. <!-- Example fragment. This can be integrated and annotated like any other android Fragment or View widget --> <fragment class="com.here.android.mpa.mapping.mapfragment" android:id="@+id/mapfragment" android:layout_width="fill_parent" android:layout_height="fill_parent"/> The MapFragment class handles all user interactions such as panning, tapping or pinching, as well as other standard HERE SDK touch gestures documented in MapGestures. Initializing MapFragment After adding the MapFragment to the layout, the fragment must be initialized. The MapFragment initialization is processed asynchronously. During initialization, the MapEngine will be initialized to create an instance of Map that will be associated with the MapFragment. The MapFragment.init(OnEngineInitListener) method takes in an OnEngineInitListener input parameter to signal the caller when initialization is completed and if it was successful. The MapFragment also initializes a MapEngine instance and creates a Map object associated with the MapFragment. The following code illustrates the basic initialization flow when an Activity is created. public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // Search for the Map Fragment
27 User Guide 27 final MapFragment mapfragment = (MapFragment) getfragmentmanager().findfragmentbyid(r.id.mapfragment); // initialize the Map Fragment and // retrieve the map that is associated to the fragment mapfragment.init(new OnEngineInitListener() { public void onengineinitializationcompleted( OnEngineInitListener.Error error) { if (error == OnEngineInitListener.Error.NONE) { // now the map is ready to be used map = mapfragment.getmap(); else { System.out.println("ERROR: Cannot initialize MapFragment"); ); Note: For performance reasons, com.here.android.mpa.mapping.mapfragment has set Fragment.setRetainInstance(boolean) to true, and therefore oncreate(bundle) will not be called again when Activity is re-created (for example, after an orientation change). Note: The MapFragment class provides an asynchronous method, getscreencapture(onscreencapturelistener), for creating map snapshots of the currently visible MapFragment area. When the snapshot has been created, an event callback to OnScreenCaptureListener occurs, and the screenshot will be provided as an android.graphics.bitmap object. This method of screen capture only works if the view is in the foreground and it is rendering. If a background or viewless screen capture is required, use MapOffscreenRenderer. Working with Map Once the MapFragment is initialized, you get the Map associated with the MapFragment through MapFragment.getMap(). The Map class represents the virtual model of the world in a digital format. The map is rendered using Mercator projection. Key attributes of the Map include the center GeoCoordinate, zoom level, orientation, and tilt. For example, the following code snippet illustrates how to use Map.setCenter(GeoCoordinate, Map.Animation) to render the Map at Vancouver, Canada. // map fragment has been successfully initialized // now the map is ready to be used Map map = mapfragment.getmap(); // Set the map center to Vancouver, Canada. map.setcenter(new GeoCoordinate( , ), Map.Animation.NONE);
28 User Guide 28 In the preceding code: The GeoCoordinate for the map center is created by a call to the new GeoCoordinate(double, double) constructor. When setting the center of a map, there is an option either to animate the change or to suppress animation by passing the constant Map.Animation.NONE as the relevant parameter. Center, Zoom, Tilt, and Orientation Here are some examples to set and get attributes of the Map: Map Center The center of the Map is a GeoCoordinate location that your Map is focused on. You can move a Map by redefining its center GeoCoordinate: // Move the map to London. map.setcenter( new GeoCoordinate(51.51,-0.11), Map.Animation.NONE ); // Get the current center of the Map GeoCoordinate coordinate = map.getcenter(); Zoom Level The size of the geographical area displayed by Map can be controlled by changing the zoom level. The zoom level ranges from getminzoomlevel() to getmaxzoomlevel(), with the minimum value displaying the entire world. The following code sets the zoom level to the median zoom level. // Get the maximum,minimum zoom level. double maxzoom = map.getmaxzoomlevel(); double minzoom = map.getminzoomlevel(); // Set the zoom level to the median (10). map.setzoomlevel((maxzoom + minzoom)/2); // Get the zoom level back double zoom = map.getzoomlevel(); Orientation The map can be orientated freely in any direction. By default, the orientation is in a true North position. The following code will change the orientation to South-up. // Rotate 180 degrees. map.setorientation(180); // Get the orientation, should be 180.
29 User Guide float orientation = map.getorientation(); Tilt The map can be tilted and rendered in a three-dimensional perspective. By default, the tilt is completely flat. You can retrieve the minimum and maximum possible tilt values by calling getmintilt() and getmaxtilt() // Set the tilt to 45 degrees map.settilt(45); // Get the tilt float tilt = map.gettilt(); Animations The map supports three types of animations when changing attributes: Map.Animation.NONE Map.Animation.LINEAR Map.Animation.BOW Note: If the map changes size or the app comes to the foreground while Map.Animation.LINEAR or Map.Animation.BOW is being used in a Map attribute setter method, then the animation will abort, and the transition will appear as failed. To avoid this behavior, use the Map.Animation.NONE animation type or wait until the map is stable before performing the transition operation. // Rotate 90 degrees using a linear animation map.setorientation(90, Map.Animation.LINEAR); // Move to Vancouver using bow animation map.setcenter(new GeoCoordinate(49.0,-123.0), Map.Animation.BOW); Setting Multiple Attributes Map.setCenter(GeoCoordinate point, Animation animation, double level, float orientation, float tilt) is an extended API provided for changing one or more attributes at the same time. The zoom level, tilt and perspective can be preserved and unchanged using Map.MOVE_PRESERVE_ZOOM_LEVEL, Map.MOVE_PRESERVE_ORIENTATION, Map.MOVE_PRESERVE_TILT respectively. // Move to Vancouver using a bow animation, zoom level 17, 180 //degree orientation and 45 degree tilt. map.setcenter(new GeoCoordinate(49.0,-123.0), Map.Animation.BOW, 17.0d, 180, 45); 29
30 User Guide 30 Map Projection Mode By default, the map is set to a globe projection mode. You can change it to use Mercator or equirectangular projection by calling setprojectionmode(projection). For example: map.setprojectionmode(map.projection.mercator); It may be useful to set the projection modes when you need to predictably display certain types of map information, such as custom raster tiles. Figure 1: Globe Projection Figure 2: Equirectangular Projection Figure 3: Mercator Projection MapState and Listening for Map Transform Events MapState is an object which is a composite of the tilt, orientation, zoom level and center map attributes. Your application can listen for updates to the MapState by using an OnTransformListener. Map transform events are triggered by any operation which causes the MapState to change. These operations include user interaction (for example, map gestures) as well as programmatic calls to the Map (for example, map.setcenter(geocoordinate, MapAnimation)). The onmaptransformstart() method is called before MapState begins to change, while the onmaptransformend(mapstate) method is called after the MapState returns to a steady value. Because of this, there can be a significant amount of time between the two callbacks in cases such as animated map movement events and continuous user interaction. The following code is an example of registering an OnTransformListener to listen for map transform events: map.addtransformlistener(new OnTransformListener() { public void onmaptransformstart() { // map transform is about to start
31 User Guide 31 public void onmaptransformend(mapstate mapstate) { // map transform has come to an end ); If you need to update UI widgets as the MapState changes between these two callbacks, the recommended approach is to trigger a Runnable when onmaptransformstart() is called, which periodically checks (at no more than 30 frames per second) the current map state via map.getmapstate() and updates the UI widgets accordingly. This Runnable can then be canceled upon a call to onmaptransformend(mapstate). An Android Handler can be used to trigger these Runnable objects. Note: Do not update UI widgets in MapRenderListener.onPostDraw(boolean, long), as this method is frequently called. Pedestrian Features By default, icons that indicate pedestrian access features (such as stairs or escalators) are not displayed on the map. To display a pedestrian feature on the map view, call the Map.setPedestrianFeaturesVisible(EnumSet) method with the desired set of PedestrianFeature. To find out whether a feature type is currently enabled, call the Map.getPedestrianFeaturesVisible() method. Figure 4: Pedestrian Feature Icons
32 User Guide 32 Map Gestures The MapGesture interface encapsulates all user interactions and touch gestures supported by the HERE SDK for Android. The MapGesture associated with a particular fragment can be retrieved from MapFragment.getMapGesture(). The default behavior of the map for each gesture type may be used as-is, supplemented, or replaces entirely. The following table is a summary of the available gestures and their default behavior. To zoom the map in a fixed amount, tap the screen twice with one finger To zoom out a fixed amount, tap the screen with two fingers To move the map, press and hold one finger to the screen, and move it in any direction. To tilt the map, press and hold two fingers to the screen, and move them in a vertical direction. No behavior is predefined for other directions. To kinetically pan the map, press and swipe one finger on the screen. The map will continue to move in the same direction, and gradually slow to a stop.
33 User Guide 33 To continuously zoom in or out, press and hold two fingers to the screen, and increase or decrease the distance between them To rotate the map, press and hold two fingers to the screen, and rotate them around each other Tap the screen with one finger. This gesture does not have a predefined map action. Press and hold one finger to the screen. This gesture does not have a predefined map action. The OnGestureListener Interface The OnGestureListener interface represents a listener to provide notification upon completion of a Map gesture event such as a single tap on a map. To use a OnGestureListener in the basic application that you are creating as a compendium to this guide, you can create a new OnGestureListener(), as illustrated below. // Map gesture listener private class MyOnGestureListener implements OnGestureListener { public void onpanstart() { public void onpanend() { public void onmultifingermanipulationstart() { public void onmultifingermanipulationend() {
34 User Guide 34 public boolean onmapobjectsselected(list<viewobject> objects) { return false; public boolean ontapevent(pointf p) { return false; public boolean ondoubletapevent(pointf p) { return false; public void onpinchlocked() { public boolean onpinchzoomevent(float scalefactor, PointF p) { return false; public void onrotatelocked() { public boolean onrotateevent(float rotateangle) { return false; public boolean ontiltevent(float angle) { return false; public boolean onlongpressevent(pointf p) { return false; public void onlongpressrelease() { public boolean ontwofingertapevent(pointf p) { return false; To add the listener to your map, include a call to addongesturelistener(ongesturelistener) after the map fragment has been successfully initialized as follows: mapfragment.init(new OnEngineInitListener() { public void onengineinitializationcompleted(onengineinitlistener.error error) { if (error == OnEngineInitListener.Error.NONE) { // map fragment has been successfully initialized
35 User Guide 35 mapfragment.getmapgesture().addongesturelistener(new MyOnGestureListener()); ); Note: After you add an OnGestureListener to an application, remember to call removeongesturelistener(ongesturelistener) when you no longer need to listen for map events to free up application resources. The default implementation of a OnGestureListener in your basic application will not affect any of the standard HERE SDK touch gestures. Each method within the MyOnGestureListener class returns a value of false, which stipulates that the application should not override the underlying action that a device will perform upon detecting a particular gesture. If you want to customize an action that your application will perform upon detection of a particular gesture, you must include appropriate commands within a relevant method of the MyOnGestureListener class and return a value of true to override the default action, as illustrated below with revisions to the ontwofingertapevent(pointf) method. public boolean ontwofingertapevent(pointf p) { // Reset the map view to its initial parameters double level = map.getminzoomlevel() + map.getmaxzoomlevel() / 2; map.setcenter(new GeoCoordinate( , ), Map.Animation.NONE); map.setzoomlevel(level); map.setorientation(0); map.settilt(0); return true; Note: Since the ontapevent(pointf) event is always triggered before the onmapobjectsselected(list<viewobject>) event, you can leverage this behavior to implement your own object selection logic. While implementing object selection, it is recommended that you use both Map.getSelectedObject(PointF) and Map.getSelectedObject(ViewRect) and combine the results, so that the user's tap input is interpreted over a larger area, rather than only a single point. After the revision, the basic application will respond to each two-finger tap gesture by returning to its initial view (the view displayed upon application launch). Other touch gestures will continue to trigger standard HERE SDK actions. Map Schemes The HERE SDK for Android provides a variety of map appearances for your application to choose from, these appearances are otherwise known as map schemes.
36 User Guide Map.Scheme defines visualization types that the HERE map service supports. There is a variety of map schemes available that can be used, based on the specific use case: Explore - Normal, Terrain, Pedestrian Overlays - Grey, Transit, Reduced, Traffic You can set a desired scheme by making a call to the Map.setMapScheme(String) method. 36
37 User Guide Examples of Map Scheme All available schemes are defined as constant strings in the Map.Scheme class. The following are examples of string values that you can use to set the map scheme in your application: Figure 5: Scheme.NORMAL_DAY Figure 6: Scheme.SATELLITE_DAY Figure 7: Scheme.HYBRID_DAY Figure 8: Scheme.HYBRID_DAY_TRANSIT 37
38 User Guide Note: In addition to the preceding schemes, Scheme.SATELLITE_NIGHT is also available. It is similar to Scheme.SATELLITE_DAY, but the color of the sky is different when the map is tilted. Figure 9: Scheme.NORMAL_NIGHT Figure 10: Scheme.NORMAL_NIGHT_TRANSIT Figure 11: Scheme.TERRAIN_DAY Figure 12: Scheme.NORMAL_DAY_TRANSIT 38
39 User Guide 39 Example Setting Map Scheme Here's an example to demonstrate how to retrieve available map schemes and change the current map scheme: // Array containing string values of all available map schemes List<String> schemes = map.getmapschemes(); // Assume to select the 2nd map scheme in the available list map.setmapscheme(schemes.get(1)); Listening for MapScheme Change Events Applications can listen for map scheme change events by way of the Map.OnSchemeChangedListener: map.addschemechangedlistener(new OnSchemeChangedListener() { public void onmapschemechanged(string mapscheme) { // react to map scheme change here ); MapEngine Class MapEngine is a singleton class used to manage active mapping resources for use in applications developed with the HERE SDK. MapEngine must be initialized before Map and map-related objects, such as MapMarker, RouteManager, and Places, can be instantiated and retrieved from the API. A runtime exception will occur if MapEngine is not properly initialized before map-related objects are used. Initialization MapEngine must be initialized before it can be used. MapEngine is automatically initialized for your application by using either MapFragment or MapActivity. MapActivity is an Activity class created for developers that do not need to display any maps in their application, but would like to use the HERE SDK for Android headless APIs for operations such as Search or Route calculations. MapFragment is a fragment class that applications can use as an UI module in an activity for map display. For more information, see MapFragment and MapActivity. However, if your application uses neither MapFragment or MapActivity classes, then the application should initialize the MapEngine before using any HERE APIs. This is done by MapEngine.init(OnEngineInitListener) API as shown below: MapEngine mapengine = MapEngine.getInstance(context);
40 User Guide 40 mapengine.init(context, new OnEngineInitListener() { public void onengineinitializatoncompleted(error error) { if (error == OnEngineInitListener.Error.NONE) { // Post initialization code goes here else { // handle factory initialization failure ); For examples of typical scenarios using the MapFragment that automatically initializes the MapEngine, see Maps on page 26. Map Objects and User Interaction You can select ViewObject objects by using a single tap gesture. To enable this in your code, create an OnGestureListener object and pass it to MapFragment.addMapGestureListener(OnGestureListener). When a single tap occurs, the listener will receive the ontapevent(pointf) callback, and if that event is not handled, then the listener will receive the onmapobjectsselected(list<viewobject>) callback. The application can then define what to do with the selected ViewObject. Types of ViewObject objects that are selectable are defined within the ViewObject.Type enumeration, which includes: USER_OBJECT - an object that the application adds to a map with a MapObject base class (MapPolygon for example). PROXY_OBJECT - an object that is added automatically to a map with a MapProxyObject base class. A proxy object may contain special information about the object, depending on the type (for example, TransitStopObject may provide transit stop-related information), but it cannot be created or modified. UNKNOWN_OBJECT - a selectable map object that is neither a USER_OBJECT nor a PROXY_OBJECT The ViewObject Abstract Class The ViewObject abstract class represents the base implementation for all objects that are selectable on a MapView or MapFragment. The MapFragment features user-selectable objects. Sub-classes of the ViewObject class include: MapObject MapProxyObject
41 User Guide 41 MapObject and Geo Objects MapObject represents an abstract class for all map-related objects that can be added on a Map. The subclasses of this abstract class include: MapContainer MapCircle MapPolyline MapPolygon MapRoute MapMarker MapLocalModel MapGeoModel MapLabeledMarker MapScreenMarker These objects can be created by calling the appropriate constructor methods with a geo object. Geo objects (for example, GeoPolyline and GeoPolygon) are geographical data representations that act as models to MapObjects, which act as views. Unlike map objects, geo objects cannot be added directly to a Map. For more information on geo objects and creating map objects, see the API Reference. The following code snippet demonstrates how to create a MapPolyline and a GeoPolyline object: List<GeoCoordinate> testpoints = new ArrayList<GeoCoordinate>(); testpoints.add(new GeoCoordinate(49.163, , 10)); testpoints.add(new GeoCoordinate(59.163, , 10)); testpoints.add(new GeoCoordinate(60.163, , 10)); GeoPolyline polyline = new GeoPolyline(testPoints); MapPolyline mappolyline = new MapPolyline(polyline); To add a MapObject to the map, use Map.addMapObject(MapObject) or Map.addMapObjects(List<MapObject>). You can use the setoverlaytype(mapoverlaytype) method to set the display layer that this map object will be rendered. By default, map objects are assigned to the foreground. MapContainer You can use MapContainer as a container for other MapObject instances. Map containers determine the stacking order of objects displayed on a map. To add a map object, call the MapContainer.addMapObject(MapObject) method. Note: MapRoute and MapContainer cannot be added to a MapContainer. Note: If a map object is a part of a MapContainer, it will have the same MapOverlayType as the map container.
42 User Guide MapCircle A MapCircle represents a type of MapObject in the shape of a circle, with an assigned radius distance and a GeoCoordinate center. It can be created by calling the constructor MapCircle(double radius, GeoCoordinate center). Figure 13: A MapCircle object 42
43 User Guide 43 MapPolyline A MapPolyline is a MapObject in the shape of a polyline with anchor points at any number of GeoCoordinate points. It can be created via a GeoPolyline object, which can be created by calling the GeoPolyline(List<GeoCoordinate> points) constructor. Figure 14: A MapPolyline object MapPolygon A MapPolygon is a MapObject in the shape of a polygon. In contrast with a MapPolyline, it is assumed that the last coordinate in the line's path is connected to the first coordinate, thereby constructing an enclosed geometry. A MapPolygon may define separate border and fill colors. To
44 User Guide 44 create a MapPolygon, use the constructor MapPolygon(GeoPolygon polygon). A GeoPolygon can be created by calling GeoPolygon(List<GeoCoordinate> points). Figure 15: A MapPolygon object MapRoute A MapRoute is a MapObject that displays a calculated route on a map. For more information on MapRoute, see Routing.
45 User Guide 45 MapMarker A MapMarker is a MapObject that displays an icon at a geographical position on a map. You can create a MapMarker with your own custom icon by calling MapMarker(GeoCoordinate, Image). Figure 16: A MapMarker object MapLabeledMarker A MapLabeledMarker is a different type of marker object that avoids overlapping with other icons and text on the map. By default, the visual appearance of a MapLabeledMarker is similar to a point
46 User Guide 46 of interest. You can choose a preset category icon (for example, IconCategory.ZOO) or set your own Image as the marker icon. Figure 17: A MapLabeledMarker object Unlike MapMarker, setting the label text to a MapLabeledMarker does not require enabling an info bubble. You can set the marker label text by providing a language and a localized string to the MapLabeledMarker.setLabelText(String, String) method. The localized text in the language that matches the current Map.getMapDisplayLanguage(), if available, will be displayed. Otherwise, the first added localized text will be displayed instead. Note: Although a MapLabeledMarker is visually similar to a point of interest, its overlay type is set to FOREGROUND_OVERLAY by default. MapLocalModel A MapLocalModel is an arbitrary 3D map object that is drawn using a local coordinate (as opposed to a geocoordinate) mesh. You can create a custom MapLocalModel by calling MapLocalModel(), and setting the model mesh, texture, orientation, and geographical location before adding it to the map. For example: FloatBuffer buff = FloatBuffer.allocate(12); // Two triangles buff.put(0- delta); buff.put(0- delta); buff.put(1.f); buff.put(0 + delta); buff.put(0 - delta); buff.put(1.f); buff.put(0 - delta); buff.put(0 + delta); buff.put(1.f); buff.put(0 + delta); buff.put(0 + delta); buff.put(1.f);
47 User Guide // Two triangles to generate the rectangle. Both front and back face IntBuffer vertindiciebuffer = IntBuffer.allocate(12); vertindiciebuffer.put(0); vertindiciebuffer.put(2); vertindiciebuffer.put(1); vertindiciebuffer.put(2); vertindiciebuffer.put(3); vertindiciebuffer.put(1); vertindiciebuffer.put(0); vertindiciebuffer.put(1); vertindiciebuffer.put(2); vertindiciebuffer.put(1); vertindiciebuffer.put(3); vertindiciebuffer.put(2); // Texture coordinates FloatBuffer textcoordbuffer = FloatBuffer.allocate(8); textcoordbuffer.put(0.f); textcoordbuffer.put(0.f); textcoordbuffer.put(1.f); textcoordbuffer.put(0.f); textcoordbuffer.put(0.f); textcoordbuffer.put(1.f); textcoordbuffer.put(1.f); textcoordbuffer.put(1.f); LocalMesh mymesh = new LocalMesh(); mesh.setvertices(buff); mesh.setvertexindices(vertindiciebuffer); mesh.settexturecoordinates(textcoordbuffer); MapLocalModel myobject = new MapLocalModel(); myobject.setmesh(mymesh); //a LocalMesh object myobject.settexture(myimage); //an Image object myobject.setanchor(mylocation); //a GeoCoordinate object myobject.setscale(20.0f); myobject.setdynamicscalingenabled(true); myobject.setyaw(45.0f); map.addmapobject(myobject); Note: While translating the 3D model mesh to the map, a unit of 1.0f represents 1 meter in the real world. For example, a Vector3f(100,200,300) represents an offset of +100 meters in the x-axis (East), +200 meters in the y-axis (North), and +300 meters in the z-axis 47
48 User Guide 48 direction (Up). You can further control the size of the 3D model mesh by setting a scaling factor with the setscale() method. Figure 18: A MapLocalModel object Aside from setting a texture, a MapLocalModel can also be customized by setting its material and lighting using the Phong reflection model. For example, the following code sets the ambient color, diffuse color, and light source to the MapLocalModel. // This light shines from above in the Z axis DirectionalLight light = new DirectionalLight(new Vector3f(0, 0.5f, 1)); m_model.addlight(light); // Give this a default color PhongMaterial mat = new PhongMaterial(); mat.setambientcolor(0xffffffff); mat.setdiffusecolor(0x ); m_model.setmaterial(mat); MapGeoModel A MapGeoModel is an arbitrary 3D map object that is drawn using geocoordinate verticies. You can create a MapGeoModel by calling its constructor and setting a list of geocoordinates, a list indicating the vertex order, a list of UV coordinates, and a texture Image. For example: List<GeoCoordinate> mylocations = Arrays.asList( new GeoCoordinate( , ), new GeoCoordinate( , ), new GeoCoordinate( , )); // vertices must be specified in a counter-clockwise manner IntBuffer vertindiciebuffer = IntBuffer.allocate(3);
49 User Guide 49 vertindiciebuffer.put(0); vertindiciebuffer.put(2); vertindiciebuffer.put(1); FloatBuffer textcoordbuffer = FloatBuffer.allocate(6); textcoordbuffer.put(0.5f); textcoordbuffer.put(0.5f); textcoordbuffer.put(0.5f); textcoordbuffer.put(0.5f); textcoordbuffer.put(0.5f); textcoordbuffer.put(0.5f); GeoMesh meshy = new GeoMesh(); meshy.setvertices(mylocations); meshy.setvertexindices(vertindiciebuffer); meshy.settexturecoordinates(textcoordbuffer); MapGeoModel mygeomodel = new MapGeoModel(); mygeomodel.setmesh(meshy); mygeomodel.settexture(mytexture); As with MapLocalModel, you can also set the lighting and color properties for a MapGeoModel using the addlight(directionallight) and setmaterial(phongmaterial) methods. Figure 19: A MapGeoModel object User Interactions with MapObject This section provides an example on handling MapObject tap events. In the following code: addmapobject() adds the object on the Map. List<ViewObject> holds the objects that have been selected in this tap event. By looping through this list of objects, your code can find the MapObject that should respond to this tap event.
50 User Guide 50 Note: The onmapobjectsselected(list) callback is triggered after the ontapevent(pointf) callback. For more information on this, refer to Map Gestures on page 32 // Create a custom marker image com.here.android.mpa.common.image myimage = new com.here.android.mpa.common.image(); try { myimage.setimageresource(r.drawable.my_png); catch (IOException e) { finish(); // Create the MapMarker MapMarker mymapmarker = new MapMarker(new GeoCoordinate(LAT, LNG), myimage); map.addmapobject(mymapmarker); // Create a gesture listener and add it to the MapFragment MapGesture.OnGestureListener listener = new MapGesture.OnGestureListener.OnGestureListenerAdapter() { public boolean onmapobjectsselected(list<viewobject> objects) { for (ViewObject viewobj : objects) { if (viewobj.getbasetype() == ViewObject.Type.USER_OBJECT) { if (((MapObject)viewObj).getType() == MapObject.Type.MARKER) { // At this point we have the originally added // map marker, so we can do something with it // (like change the visibility, or more // marker-specific actions) ((MapObject)viewObj).setVisible(false); // return false to allow the map to handle this callback also return false; ; Handling MapProxyObject objects The following code demonstrates how to handle tap events on a MapProxyObject: The onmapobjectsselected event of the OnGestureListener listens to object selected. For more information on OnGestureListener, refer to Map Gestures on page 32. If the selected object is a PROXY_OBJECT then you can safely cast the ViewObject into a MapProxyObject. If the selected object is a USER_OBJECT then you need to find the object using the hash map; refer to the preceding example. private MapGesture.OnGestureListener listener = new MapGesture.OnGestureListener.OnGestureListenerAdapter() { public boolean onmapobjectsselected(list<viewobject> objects) { for (ViewObject obj : objects) { switch (obj.getbasetype()) {
51 User Guide case PROXY_OBJECT: MapProxyObject proxyobj = (MapProxyObject) obj; switch (proxyobj.gettype()) { case TRANSIT_ACCESS: TransitAccessObject transitaccessobj = (TransitAccessObject) proxyobj; Log.d(TAG, "Found a TransitAccessObject"); break; case TRANSIT_LINE: TransitLineObject transitlineobj = (TransitLineObject) proxyobj; Log.d(TAG, "Found a TransitLineObject"); break; case TRANSIT_STOP: TransitStopObject transitstopobj = (TransitStopObject) proxyobj; Log.d(TAG, "Found a TransitStopObject"); break; default: Log.d(TAG, "ProxyObject.getType() unknown"); break; // User objects are more likely to be handled // as in the previous example case USER_OBJECT: default: Log.d(TAG, "ViewObject.getBaseType() is USER_OBJECT or unknown"); break; return true; ; Transit Information Your application can use API calls from the HERE SDK for Android to display transit information for users. Note: The transit map schemes (NORMAL_DAY_TRANSIT, NORMAL_NIGHT_TRANSIT, and HYBRID_DAY_TRANSIT) are specifically designed for displaying transit information. You can opt to use one of these schemes when your app displays transit information. MapTransitLayer MapTransitLayer is a layer that displays the available transit data for a map area. To customize the transit layer, call Map.getMapTransitLayer() to access the methods available through the MapTransitLayer class. For example, to show all transit information available: // Assumes map is instantiated 51
52 User Guide 52 map.getmaptransitlayer().setmode(maptransitlayer.mode.everything); Figure 20: MapTransitLayer set to show everything To show only transit stops and accesses call: // Assumes map is instantiated map.getmaptransitlayer().setmode(maptransitlayer.mode.stops_and_accesses); Figure 21: MapTransitLayer set to show only transit stops and accesses To hide all transit information call: // Assumes map is instantiated
53 User Guide 53 map.getmaptransitlayer().setmode(maptransitlayer.mode.nothing); Highlighting Transit Objects The following four types of transit data objects are currently available: Transit Stop data - represented by TransitStopObject Transit Line data - represented by TransitLineObject Transit Access data - represented by TransitAccessObject Transit Line Segment data - represented by TransitLineSegmentObject Transit objects can be selected through tap gestures. For example, to highlight a single or a group of TransitLineObject, you need to know the unique identifier of the line objects. Depending on the use case, there are several ways of getting a single or a list of Identifier objects: Call TransitLineObject.getLineId() when user has selected a TransitLineObject by tapping on it. It returns an Identifier of the currently selected transit line. Call TransitStopObject.getTransitStopInfo().getLines() when user has selected a TransitStopObject via tapping. getlines() returns a list of Identifier of the lines connected to the selected transit stop. For details of handling tappable MapProxyObjects, see Handling MapProxyObject objects on page 50. With a single or a list of Identifier objects, you call the following API to highlight the lines: // Assumes map is instantiated and identifierlist is // filled with a list of Identifiers
54 User Guide map.getmaptransitlayer().highlighttransitlines(identifierlist); Figure 22: MapTransitLayer highlighting transit lines connected to the selected transit stop TransitStopObject A TransitStopObject is a type of MapProxyObject that contains information about a transit stop. The following figures show the different types of transit stops: Figure 23: TransitStopObject: A metro station Figure 24: TransitStopObject: A ferry station 54
55 User Guide 55 To acquire information about a tapped TransitStopObject (see Handling MapProxyObject objects on page 50 ) use onmapobjectsselected(list<viewobject>) as in the following: private MapGesture.OnGestureListener listener = new MapGesture.OnGestureListener() { public boolean onmapobjectsselected(list<viewobject> objects) { for (ViewObject obj : objects) { if (obj.getbasetype() == ViewObject.Type.PROXY_OBJECT) { MapProxyObject proxyobj = (MapProxyObject) obj; if (proxyobj.gettype() == MapProxyObject.Type.TRANSIT_STOP) { TransitStopObject transitstopobj = (TransitStopObject) proxyobj; Log.d(TAG, "Found a TransitStopObject"); Log.d(TAG, "position is " + transitstopobj.getcoordinate().tostring()); TransitStopInfo transitstopinfo = transitstopobj.gettransitstopinfo(); return true; The TransitStopObject provides two methods for getting information about the transit stop: getcoordinate() gets the location coordinates of the transit stop. gettransitstopinfo() gets further information about the transit stop. TransitStopInfo The TransitStopInfo class contains transit stop information that is accessed by calling one or more of the following methods getofficialname() gets the official name of the transit stop getinformalname() gets the informal name of the transit stop getid() gets the Identifier of the transit stop gettransittypes() gets the transit types this transit stop belongs to, it can be more than one. getlines() gets a list of Identifier objects for transit lines connected to this transit stop Each Identifier is submitted to the TransitDatabase to get further information. For more details, see TransitDatabase. Also they can be submitted to the MapTransitLayer to get highlighted on the map. (See MapTransitLayer on page 51) An example of getting information about the first transit line connected to the transit stop is provided below. A TransitDatabase.OnGetTransitInfoListener will need to be implemented to receive the TransitLineInfo. (See TransitLineInfo on page 57)
56 User Guide 56 An asynchronous request is submitted to the TransitDatabase along with the OnGetTransitInfoListener. TransitDatabase.OnGetTransitInfoListener listener = new TransitDatabase.OnGetTransitInfoListener() { public void ontransitlineinfo(transitlineinfo info) { // transitstopinfo is a TransitStopInfo object mtransitdatabase.getlineinfo(transitstopinfo.getlines().get(0), listener); TransitLineObject A TransitLineObject is a type of MapProxyObject that contains information about a transit line. The following figure shows examples of different types of transit lines: Figure 25: Three types of transit lines: Metro, Train and Water To acquire information about a tapped TransitLineObject (see Handling MapProxyObject objects on page 50 ) use onmapobjectsselected(list<viewobject>) as illustrated in the following code: private MapGesture.OnGestureListener listener = new MapGesture.OnGestureListener() { public boolean onmapobjectsselected(list<viewobject> objects) {
57 User Guide 57 for (ViewObject obj : objects) { if (obj.getbasetype() == ViewObject.Type.PROXY_OBJECT) { MapProxyObject proxyobj = (MapProxyObject) obj; if (proxyobj.gettype() == MapProxyObject.Type.TRANSIT_LINE) { TransitLineObject transitlineobj = (TransitLineObject) proxyobj; Log.d(TAG, "Found a TransitLineObject"); Log.d(TAG, "Id is " + transitlineobj.getlineid().tostring()); mtransitdatabase.getlineinfo(m_lineidlist.get(0), mongettransitinfolistener); return true; The TransitLineObject provides a single method for getting the Identifier of the transit line. This Identifier can be submitted to the MapTransitLayer to get highlighted on the map. (For more information, please refer to MaptransitLayer) As shown in the example above, the Identifier can also be submitted to the TransitDatabase (see TransitDatabase) along with the OnGetTransitInfoListener to get more information about the transit line. mongettransitinfolistener is implemented to receive the TransitLineInfo object from the TransitDatabase. TransitDatabase.OnGetTransitInfoListener mongettransitinfolistener = new TransitDatabase.OnGetTransitInfoListener() { public void ontransitlineinfo(transitlineinfo info) { TransitLineInfo The TransitLineInfo class contains transit line information that is accessed by calling one or more of the following methods: getofficialname() gets the official name of the transit line getinformalname() gets the informal name of the transit line getshortname() gets the short name of the transit line gettransittype() gets the transit types this transit line belongs to.
58 User Guide 58 TransitAccessObject A TransitAccessObject is a type of MapProxyObject that contains information about a transit access. A transit access is an entrance/exit to a transit stop. There can be multiple transit accesses to a transit stop. Transit access is presented as a smaller transit stop with a downward triangle attached to the bottom and is visible only in higher zoom levels. The icons presenting the transit stops and access vary between different countries and companies. The following figures show two examples: Figure 26: Transit Stop and Access: Metro Station with Single Figure 27: Transit Stop and Access: Metro Station with Access Mutiple Accesses To acquire information about a tapped TransitAccessObject (see Handling MapProxyObject objects on page 50) use onmapobjectsselected(list<viewobject>) as in the following code: private MapGesture.OnGestureListener listener = new MapGesture.OnGestureListener() { public boolean onmapobjectsselected(list<viewobject> objects) { for (ViewObject obj : objects) { if (obj.getbasetype() == ViewObject.Type.PROXY_OBJECT) { MapProxyObject proxyobj = (MapProxyObject) obj; if (proxyobj.gettype() == MapProxyObject.Type.TRANSIT_ACCESS) { TransitAccessObject transitaccessobj = (TransitAccessObject) proxyobj; Log.d(TAG, "position is " +
59 User Guide 59 transitaccessobj.getcoordinate().tostring()); TransitAccessInfo transitaccessinfo = transitaccessobj.gettransitaccessinfo(); break; return true; The TransitAccessObject provides two methods for getting information about the transit access: getcoordinate() gets the location coordinates of the transit access. gettransitaccessinfo() gets further information about the transit access. TransitAccessInfo The TransitAccessInfo class contains transit access information that can be accessed by calling one or more of the following methods gettransittypes() gets the transit types this transit access belongs to, it can be more than one. getstopid() gets a unique Identifier of the transit stop that this transit access leads to. In the next example, the unique identifier of the transit stop is submitted to the TransitDatabase to get further information. For more details, see TransitDatabase. // transitaccessinfo is a TransitAccessInfo object Log.d(TAG, "transit type is " + transitaccessinfo.gettransittypes().tostring()); Log.d(TAG, "Stop Id is " + transitaccessinfo.getstopid().tostring()); mtransitdatabase.getstopinfo(transitaccessinfo.getstopid(), mongettransitinfolistener); An example of getting information about the destination transit stop of a transit access is provided below. An OnGetTransitInfoListener will need to be implemented to receive the TransitStopInfo object. (See TransitStopInfo) An asynchronous request is submitted to the TransitDatabase along the OnGetTransitInfoListener. TransitDatabase.OnGetTransitInfoListener mongettransitinfolistener = new TransitDatabase.OnGetTransitInfoListener(){ public void ontransitstopinfo(transitstopinfo info) {
60 User Guide 60 // transitaccessinfo is a TransitAccessInfo object mtransitdatabase.getstopinfo(transitaccessinfo.getstopid(), mongettransitinfolistener); TransitSystemInfo The TransitSystemInfo class contains information about a public transit system that can be accessed by calling one or more of the following methods: getsystemofficialname() - gets the official name of the transit system getsystemwebsiturl() - gets the website URL of the transit system getcompanyofficialname() - gets the official transit system company name getcompanywebsiteurl() - gets the website URL of the transit system company getcompanyrouteplannerurl() - gets the route planner URL of the transit system company getcompanyscheduleurl() - gets the schedule url of the transit system company getcompanyphone() - gets the phone number for the transit system company getbicyclehours() - gets the tranit system's bicycle parking hours getsystemlogo() - gets the system logo (if present) getcompanylogo() - gets the companylogo (if presents) An example of retrieving transit system information is provided below. In this example, an OnGetTransitInfoListener is implemented to receive the TransitSystemInfo object. For more information, see the TransitDatabase section. TransitDatabase.OnGetTransitInfoListener mongettransitinfolistener = new TransitDatabase.OnGetTransitInfoListener() { public void ontransitsysteminfo(transitsysteminfo systeminfo) { String officialname = systeminfo.getsystemofficialname(); // transitlineinfo is a TransitLineInfo object mtransitdatabase.getsysteminfo(transitlineinfo.getsystemid(), mongettransitinfolistener);
61 User Guide 61 TransitDatabase The TransitDatabase class is responsible for querying transit information of various types from a unique Identifier, with a OnGetTransitInfoListener for monitoring query results and triggering appropriate callback methods upon completion. Applications can call the TransitDatabase constructor to activate a TransitDatabase for querying transit information. The OnGetTransitInfoListener interface can be used to monitor query results of the TransitDatabase. It is required to be implemented within the application and submitted as part of the asynchronous query request. TransitDatabase.OnGetTransitInfoListener mongettransitinfolistener = new TransitDatabase.OnGetTransitInfoListener() { public void ontransitlineinfo(transitlineinfo info) { public void ontransitstopinfo(transitstopinfo info) { public void ontransitaccessinfo(transitaccessinfo info) { public void ontransitsysteminfo(transitsysteminfo info) { public void onend(transitdatabaseerror error) { ; The OnGetTransitInfoListener class provides five callbacks: ontransitlineinfo provides a TransitLineInfo object. (See TransitLineInfo on page 57) ontransitstopinfo provides a TransitStopInfo object. (See TransitStopInfo on page 55) ontransitaccessinfo provides a TransitAccessInfo object. (See TransitAccessInfo on page 59) ontransitsysteminfo provides a TransitSystemInfo object. (See TransitSystemInfo on page 60) onend is a callback that signifies the asynchronous query request has completed.
62 User Guide 62 Note: TransitDatabase rejects all subsequent requests unless it has completed the current request. An INVALID_OPERATION will result if the TransitDatabase is busy. An asynchronous request is submitted to the TransitDatabase along with the OnGetTransitInfoListener. Note that the TransitDatabase instance is created by simply calling the TransitDatabase constructor. The following lists the main use cases of the TransitDatabase: getlineinfo() - Pass in TransitLineObject.getLineId() when user has selected a TransitLineObject by tapping on it. This method returns an Identifier of the currently selected transit line. // transitlineobject is a TransitLineObject object mtransitdatabase.getlineinfo(transitlineobject.getlineid(), mongettransitinfolistener); getlineinfo() - Pass in TransitStopObject.getTransitStopInfo().getLines() when user has selected a TransitStopObject by tapping on it. This method returns a list of Identifier of the lines connected to the selected transit stop. // transitstopinfo is a TransitStopInfo object // Requesting transit line info of the first identifier on the list. mtransitdatabase.getlineinfo(transitstopinfo.getlines().get(0), mongettransitinfolistener); getstopinfo() - Pass in TransitAccessInfo.getStopId() when user has selected a TransitAccessObject by tapping on it. This method returns a an Identifier of the stop that the transit access leads to. // transitaccessinfo is a TransitAccessInfo object mtransitdatabase.getstopinfo(transitaccessinfo.getstopid(), mongettransitinfolistener); Transit-related enumerations The TransitType enum - represents values describing different transit types, such as BUS_PUBLIC, RAIL_METRO or TRAIN_REGIONAL. The TransitDatabase.Error enum - represents values describing possible transit database errors, such as NONE or INVALID_PARAMETERS Positioning The HERE SDK for Android provides the following interfaces for users to retrieve location updates and to display their current location on a map:
63 User Guide PositioningManager OnPositionChangedListener PositionIndicator 63 PositioningManager Class A PositioningManager class provides information related to the device's geographical location, like the current position and the average speed. Applications can register to receive position updates using one of the positioning mechanisms described in the LocationMethod: GPS - positioning using the real GPS available on the device. GPS_NETWORK - positioning is provided using a wireless network or the real GPS available on the device NETWORK - positioning using a wireless network. The current status of a particular location method is represented by the LocationStatus value returned from the PositioningManager.getLocationStatus(LocationMethod) method. PositioningManager can be accessed by calling PositioningManager.getInstance(). An application can start receiving real time positioning updates by calling PositioningManager.start(LocationMethod) with one of the location methods listed above and can stop the positioning updates by calling PositioningManager.stop(). While position updates are being received, an application can retrieve the current position of the client device via the PositioningManager.getPosition() method. OnPositionChangedListener Interface In addition to the PositionManager's getposition() method, applications can subscribe to position update notifications from the PositioningManager through the PositionManager.OnPositionChangedListener interface. To add or remove OnPositionChangedListener, applications can use the following methods: PositioningManager.addListener(WeakReference<OnPositionChangedListener>) PositioningManager.removeListener(OnPositionChangedListener) The positioning manager enhances your application with the current position of the user's device. The registration of the positioning listener should be performed after the MapFragment, MapView, MapActivity, or MapEngine is initialized as described in the following code snippet. // Define positioning listener private OnPositionChangedListener positionlistener = new OnPositionChangedListener() {
64 User Guide public void onpositionupdated(locationmethod method, GeoPosition position, boolean ismapmatched) { // set the center only when the app is in the foreground // to reduce CPU consumption if (!paused) { map.setcenter(position.getcoordinate(), Map.Animation.NONE); public void onpositionfixchanged(locationmethod method, LocationStatus status) { ; // Register positioning listener PositioningManager.getInstance().addListener( new WeakReference<OnPositionChangedListener>(positionListener)); In order to avoid unnecessary position updates while the activity is in the background, you need to start or stop the PositioningManager within your activity's onresume() and onpause() methods. // Resume positioning listener on wake up public void onresume() { super.onresume(); paused = false; PositioningManager.getInstance().start( PositioningManager.LocationMethod.GPS_NETWORK); // To pause positioning listener public void onpause() { PositioningManager.getInstance().stop(); super.onpause() paused = true; // To remove the positioning listener public void ondestroy() { // Cleanup PositioningManager.getInstance().removeListener( positionlistener); map = null; super.ondestroy(); PositionIndicator Class PositionIndicator is a special map marker object that allows the current client device position to be shown on a map. Every HERE SDK Map object has an integrated position 64
65 User Guide indicator, set to invisible, by default. The indicator can be retrieved and set to visible by calling Map.getPositionIndicator() and PositionIndicator.setVisible(), as follows: // map fragment has been successfully initialized, // now the map is ready to be used map = mapfragment.getmap(); // Display position indicator map.getpositionindicator().setvisible(true); By default, the position indicator is rendered as a marker surrounded by a circle, the diameter of which illustrates the accuracy of the indicated position. You can change this marker by calling PositionIndicator.setMarker(Image). Figure 28: A PositionIndicator 65
66 User Guide 66 Note: For the position indicator to stay in the center of the map and illustrate real-time updates of the device's position, it is necessary to update the map's center whenever a new location update is received. Note: PositionIndicator only works if the application has started the PositioningManager. MapActivity Class MapActivity is an Activity class created for applications that use the HERE SDK for Android headless APIs, but do not require for a map to be displayed. Examples of these activities include search and route calculation. MapActivity is a class derived from android.app.activity. It handles the initialization and management of the MapEngine internally. Upon oncreate() being called, the MapActivity willinitializethe MapEngine. It takes care of the necessary actions that is needed for the activity to switch between background and foreground. Moreover, the inheriting activity can override the method MapActivity.onInitialized(OnEngineInitListener.Error error) to be notified when MapEngine completes its initialization and if it is ready for use. The following is an example of an activity that only uses headless APIs from the HERE SDK for Android: public class CalculateRouteActivity extends MapActivity { protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // customized oncreate() for this activity // override to handle actions when MapFactory finishes initialization, // for instance route calculation that uses headless APIs from the // Android SDK. protected boolean oninitialized(onengineinitlistener.error error) { if (error == OnEngineInitListener.Error.NONE) { // eg. do route calculation RouteManager.getInstance().calculateRoute() else { // MapEngine initialization failed!
67 User Guide 67 Extruded Buildings Figure 29: Extruded Buildings on a Map of San Francisco HERE SDK for Android supports 3D representations of buildings and structures. This feature is called extruded buildings, and you can display them by using the setextrudedbuildingsvisible() method in com.here.android.mpa.mapping.map. Extruded buildings are available for most metropolitan areas in North America and Europe. The MapBuildingLayer Class The main entry point for extruded buildings is the MapBuildingLayer class, which can be retrieved by calling getmapbuildinglayer() from a Map. MapBuildingLayer provides methods for working with building groups and individual buildings such as: getbuilding() createnewbuildinggroup() releasebuildinggroup() getdefaultbuildinggroup() These APIs provide a way for the developer to create groups of buildings (for example, to highlight them in a blue color), or to retrieve a default group containing all possible extruded buildings onscreen. Note: The extruded building methods are in effect even when buildings are invisible. For example, calling getdefaultbuildinggroup() returns the default group, even if you have
68 User Guide 68 called setextrudedbuildingsshown(false) or if the current zoom level does not allow for visible extruded buildings. The MapBuildingGroup Class The MapBuildingGroup class represents a group of buildings. There are two types of groups: New building groups - Created by calling createnewbuildinggroup(). No building is attached to this group when it is created. An application can have a maximum of six new building groups at a time. Default building groups - Retrieved by calling getdefaultbuildinggroup(). The default building group is a generic group that represents all possible buildings in the entire world. There are two distinct types of default building groups IMPORTANT_BUILDINGS, which are textured landmark buildings, and NORMAL_BUILDINGS, which include all other buildings. Each MapBuildingGroup holds an EnumSet of building faces, a color, as well as a building height scaling factor. To control the appearance of extruded buildings, you can set these attributes and add buildings to the group. For example, to highlight a building's roof, create a new building group, set the group's roof color as Color.RED, and then add a building to this group, as in the following code: // retrieve a reference of the map from the map fragment map = mapfragment.getmap(); // Create a custom building group buildinggroup = map.getmapbuildinglayer().createnewbuildinggroup(); // Set the buildinggroup's roof color to "red" buildinggroup.setcolor(color.red, EnumSet.of(MapBuildingGroup.BuildingFace.ROOF)); // Set the buildinggroup's height buildinggroup.setverticalscale(0.90f); buildinggroup.addbuilding(mybuildingidentifier);
69 User Guide Note: Remember to call releasebuildinggroup() to release any unused building groups. Otherwise, users may receive a null pointer exception after the device has been rotated a few times. Figure 30: Highlighting a Building Note: By default, a new MapBuildingGroup has the color MapBuildingLayer.DefaultBuildingColor.SELECTED on all building faces. The following table shows the values that can be used to highlight building faces: MapBuildingGroup.BuildingFace.ROOF 69
70 User Guide MapBuildingGroup.BuildingFace.OUTLINE MapBuildingGroup.BuildingFace.WALLBOTTOM MapBuildingGroup.BuildingFace.WALLTOP 70
71 User Guide 71 MapBuildingGroup.BuildingFace.LANDMARKS - Please note that this value is only applicable for landmarks. When this value is used, the entire landmark is shaded. The MapBuildingObject Class The MapBuildingObject class represents a single building, with the following attributes: a name a geocoordinate position the building height, in meters a unique map building identifier To detect whether a user has tapped on an extruded building, use MapGesture.OnGestureListener and look for the selected MapBuildingObject: private MapGesture.OnGestureListener gesturelistener = new MapGesture.OnGestureListener.OnGestureListenerAdapter() { public boolean onmapobjectsselected(list<viewobject> objects) { for (ViewObject vo : objects) { if (vo instanceof MapBuildingObject) { // Remove currently selected building buildinggroup.removeallbuildings(); // Add this building to the group. MapBuildingObject building = (MapBuildingObject) vo; buildinggroup.addbuilding(building.getidentifier()); return false; ;
72 User Guide 72 3D Landmarks Figure 31: A Landmark on a Map of San Francisco Another related feature in the Map class is 3D landmarks. By calling Map.setLandmarksVisible(true), you can enable certain landmark structures to become visible. These structures are presented with textures and more details in their 3D geometry, as seen in the screenshot above. Landmarks are not visible when the map is set to a Hybrid or Satellite map scheme. Custom Raster Tiles You can use the HERE SDK for Android to enhance maps with custom raster tiles. Custom raster tiles are tile images that you can add to a map to customize it with enhanced information. For example, you may wish to use this feature to add heat maps over a map of New York City. You can store
73 User Guide 73 custom raster tile images locally or on a remote server for users to access when they navigate in a map. If the application is set to display custom raster tiles, users will see them whenever they are viewing a designated geographical area at a specified zoom level or range of zoom levels. Dividing a Map and Tile Lookup To use your own custom raster tile images, you need to have a scheme of dividing your map according to the zoom level and map coordinates, and then provide map tiles according to this scheme. Your application will then use this scheme in the implementation of one of the following classes: MapRasterTileSource - Implement this class if you plan to fetch local tile images, create dynamic images, or if you would like to provide your own method of retrieving images from a remote server. UrlMapRasterTileSourceBase - This is a convenience child class of MapRasterTileSource. Implement this if you plan to fetch tile images from a remote server using a URL over HTTP. Note: Raster tiles can be one of the following supported image types: PNG JPEG BMP Once a tile source has been implemented, you can toggle its display by adding or removing it to the map using Map.addRasterTileSource(MapRasterTileSource) or Map.removeRasterTileSource(MapRasterTileSource). The MapRasterTileSource Abstract Class MapRasterTileSource is the common way for you to define your raster tile source. If your application uses local tile images or remote images that require custom server authentication, then you should implement this class by defining the hastile() and gettilewitherror() methods. For example: public class MyTileSource extends MapRasterTileSource { public boolean hastile(int x, int y, int zoomlevel) { return true; public TileResult gettilewitherror(int x, int y, int zoomlevel) { byte[] myimagedata = null; // perform tile retrieval logic such as server authentication // also translate the x, y, and zoomlevel to address an image TileResult result = new TileResult(Error.none, myimagedata);
74 User Guide 74 return result; Note: Ensure that gettilewitherror() returns within a reasonable amount of time. If your operation takes a longer period of time, launch an asynchronous operation and return the TileResult.Error.NOT_READY error code while the operation is in progress. The UrlMapRasterTileSourceBase Abstract Class UrlMapRasterTileSourceBase is a child abstract class of MapRasterTileSource that you can use if you plan to fetch tile images from a remote server using image URLs. The following is a sample implementation of UrlMapRasterTileSourceBase. In this example, we use the MapRasterTileSource.MapTileSystemHelper.tileXYToQuadKey() method to address our map tiles. This helper method assumes that we are using a quadtree/quadkey scheme, where the map is divided into a quadtree (a tree data structure where each node has exactly four children) with 20 levels. Each level of this map quadtree has (2Floor(zoomlevel))2 tiles, so for level 0, there is 1 x 1 = 1 tile, level 1 has 2 x 2 = 4 tiles, level 2 has 4 x 4 = 16 tiles and level 3.7 has 8 x 8 = 64 tiles. For more information about the quadkey/quadtree division scheme, see the tilexytoquadkey() API reference. public class LiveMapRasterTileSource extends UrlMapRasterTileSourceBase { private final static String URL_FORMAT = " public LiveMapRasterTileSource() { // We want the tiles placed over everything else setoverlaytype(mapoverlaytype.foreground_overlay); // We don't want the map visible beneath the tiles settransparency(transparency.off); // We don't want the tiles visible between these zoom levels hideatzoomrange(12, 20); // Do not cache tiles setcachingenabled(false); // Implementation of UrlMapRasterTileSourceBase public String geturl(int x, int y, int zoomlevel) { String url = null; // Utility to easily map the x, y coordinate into an equivalent // Quadkey at a specified zoomlevel String quadkey = MapTileSystemHelper.tileXYToQuadKey(x, y, zoomlevel); try { // Append the quadkey to the URL template to get a real URL url = String.format(URL_FORMAT, quadkey); catch (Exception ex) { ex.printstacktrace(); return url;
75 User Guide 75 The example above generates a quadkey from the x, y coordinates and the zoom level and appends it to the URL. However, this is server-specific and the method of converting x, y and zoom level to a URL can be done in many ways. Also, it is worth noting that tiles can be cached with setcachingenabled(true). Changing the Overlay Rendering Order You can choose to customize the order that raster tiles are rendered by calling MapRasterTileSource.setOverlayType(MapOverlayType). For example MapOverlayType.BACKGROUND_OVERLAY and MapOverlayType.BACKGROUND_REPLACEMENT are similar to rendering raster tiles with streets rendered on top. MapOverlayType.FOREGROUND_OVERLAY will render tiles on top of everything on the map. Caching Tiles Tiles can be cached to the disk by calling the following: // Give the tile source a custom prefix so it can be cached on the disk MapRasterTileSource.setCachePrefix( Sting cache ) // Give each raster tile file an expiration time in seconds. MapRasterTileSource.setCacheExpiration( int seconds ) If no expiration time is set, then the raster tiles will remain on the device. It is recommended to set both a cache prefix and expiration time. Places This section provides an overview of the Places feature in the HERE SDK. The Places feature enables developers to build rich, location-aware applications by adding point of interest search, discovery, interaction, and information retrieval. For example, when an application submits a place discovery request using this API, the application receives a response that contains a list of links to places resources (among other information). By accessing one of the linked Place resources, the application can get detailed information about that place, including ratings, images, reviews, editorials, and owner content. This detailed place response also contains references to other related places, allowing the applications users to discover other places relevant or related to their original search. Note: To use the HERE Places feature, your application must include the google-gson library (release or a compatible version) on its class path. This library can be downloaded from
76 User Guide 76 the google-gson project website at Attempting to use the Places feature without adding this library will cause runtime errors. Geocoding and Reverse Geocoding Geocoding and reverse geocoding APIs from the HERE SDK for Android allow application developers to offer search functionality for requesting location information and structured addresses. Geocoding APIs resolve to a GeoCoordinate from geographic data such as Address, while reverse geocoding APIs resolve to a geographic data, such as Address, from a GeoCoordinate. Address provides textual address information, which includes house number, street name, city, country, and district. It encompasses everything about an address or a point on the map. Location represents a physical point on the map where additional attributes can be retrieved. These additional attributes include a unique identifier, label, Address, GeoCoordinate and GeoBoundingBox for the Location. The GeocodeRequest Class GeocodeRequest represents an extended Request. GeocodeRequest can be created using a structured Address: new GeocodeRequest(Address) The GeocodeRequest can also be created as a one-box (free-formatted text) search using a combination of a text query string and geographical area arguments. The following shows the method used to create a one-box request: GeocodeRequest request = new GeocodeRequest(String).setSearchArea(GeoCoordinate, int) The preceding two methods return a GeocodeRequest object. To begin the search, call GeocodeRequest.execute(). This method requires a ResultListener as an argument. When the search is completed, the ResultListener.onCompleted() method is called with a result status and a list of found locations. After a request is invoked, it can be cancelled using the GeocodeRequest.cancel() method, which returns true if the request was cancelled successfully. For GeocodeRequest, a list of Location objects are expected at the completion of the request. The following code example demonstrates how to perform a GeocodeRequest using an Address: // Implementation of ResultListener class GeocodeListener implements ResultListener<List<Location>> { public void oncompleted(list<location> data, ErrorCode error) { if (error!= ErrorCode.NONE) {
77 User Guide // Handle error else { // Process result data // Instantiate an Address object Address berlin_address = new Address(); berlin_address.sethousenumber("100"); berlin_address.setstreet("invalidenstrasse"); berlin_address.setpostalcode("10115"); berlin_address.setcity("berlin"); berlin_address.setcountrycode("deu"); ResultListener<List<Location>> listener = new GeocodeListener(); GeocodeRequest request = new GeocodeRequest(berlin_address); if (request.execute(listener)!= ErrorCode.NONE) { // Handle request error The following code example demonstrates how to perform a GeocodeRequest using new GeocodeRequest(String).setSearchArea(GeoCoordinate, int): // Implementation of ResultListener class GeocodeListener implements ResultListener<List<Location>> { public void oncompleted(list<location> data, ErrorCode error) { if (error!= ErrorCode.NONE) { // Handle error else { // Process result data // Instantiate a GeoCoordinate object GeoCoordinate vancouver = new GeoCoordinate( , ); // Example code for creating a OneBox Request ResultListener<List<Location>> listener = new GeocodeListener(); GeocodeRequest request = new GeocodeRequest("Granville").setSearchArea(vancouver, 5000); if (request.execute(listener)!= ErrorCode.NONE) { // Handle request error 77
78 User Guide 78 The ReverseGeocodeRequest Class The ReverseGeocodeRequest class represents an extended Request used to retrieve Address data. The request is created using a GeoCoordinate as shown below: new ReverseGeocodeRequest(GeoCoordinate) The above method returns a ReverseGeocodeRequest object. To invoke the request, you can then call the execute() method of the returned ReverseGeocodeRequest object and pass in a ResultListener to retrieve the information about the completion of the request. Once a request is invoked, the request can be cancelled via the ReverseGeocodeRequest.cancel() method. cancel() returns true if the request was cancelled successfully. For ReverseGeocodeRequest, a structured Address is expected at the completion of the request. The following is an example of creating ReverseGeocodeRequest using new ReverseGeocodeRequest(GeoCoordinate): // Implementation of ResultListener class ReverseGeocodeListener implements ResultListener<Address> { public void oncompleted(address data, ErrorCode error) { if (error!= ErrorCode.NONE) { // Handle error else { // Process result data // Instantiate a GeoCoordinate object GeoCoordinate vancouver = new GeoCoordinate( , ); // Example code for createreversegeocoderequest(geocoordinate) ResultListener<Address> listener = new ReverseGeocodeListener(); ReverseGeocodeRequest request = new ReverseGeocodeRequest(vancouver); if (request.execute(listener)!= ErrorCode.NONE) { // Handle request error Search and Discovery The HERE SDK for Android provides application developers the Places API which allows places discovery and information retrieval.
79 User Guide 79 Steps for performing a search 1. Implement the ResultListener interface to handle the completion of the search 2. Create a request and apply request options 3. Invoke the request by calling Request.execute(ResultListener) 4. The ResultListener.onCompleted() callback is triggered when the request is finished Note: Generally, applications that use the Places API must honor the following prescribed workflow: 1. Search 2. Request for Details 3. Perform Actions It is not permitted to write applications that preload results that are linked from a response in order to improve performance. For more information about usage restrictions, please consult the API Implementation Check List in the REST HERE Places API documentation. Discovery Requests The HERE Places Search API supports the following discovery requests: Search - finds places that match user-provided search terms Explore - guides to places of interest nearby. Use this type of request if you are trying to answer the question "What interesting places are in the map viewport?" Here - guides to places of interest within a close proximity. Use this type of request if you are trying to answer the question "What is here at this location?" Here requests are typically used by applications that include "check-in" or "tap on map to get more information" options. New discovery requests can be created using the following constructors: new SearchRequest(String) new ExploreRequest() new HereRequest() The following code example demonstrates how to perform a search discovery request: // Example Search request listener class SearchRequestListener implements ResultListener<DiscoveryResultPage> { public void oncompleted(discoveryresultpage data, ErrorCode error) { if (error!= ErrorCode.NONE) { // Handle error else { // Process result data
80 User Guide 80 // Create a request to search for restaurants in Seattle try { GeoCoordinate seattle = new GeoCoordinate( , ); DiscoveryRequest request = new SearchRequest("restaurant").setSearchCenter(seattle); // limit number of items in each result page to 10 request.setcollectionsize(10); ErrorCode error = request.execute(new SearchRequestListener()); if( error!= ErrorCode.NONE ) { // Handle request error catch (IllegalArgumentException ex) { // Handle invalid create search request parameters The result of a discovery request (Search, Explore, Here) is a DiscoveryResultPage. The DiscoveryResultPage represents a paginated collection of items from which the following can be retrieved: Next page request - a discovery request used to retrieve additional pages of search items Items for the current page - a List of DiscoveryResult When additional pages of search results are needed, retrieve and invoke the DiscoveryRequest returned by DiscoveryResultPage.getNextPageRequest(). If the next page request is null, no additional results are available. The following is an example: DiscoveryResultPage mresultpage = null; // Example Search request listener class SearchRequestListener implements ResultListener<DiscoveryResultPage> { public void oncompleted(discoveryresultpage data, ErrorCode error) { if (error!= ErrorCode.NONE) { // Handle error else { // Store the last DiscoveryResultPage for later processing mresultpage = data; // When the next page of results is needed DiscoveryRequest nextpagerequest = mresultpage.getnextpagerequest(); if (nextpagerequest!= null) { // More data is available if the nextpagerequest is not null ErrorCode error = nextpagerequest.execute(new SearchRequestListener());
81 User Guide 81 if( error!= ErrorCode.NONE ) { // Handle request error Calling DiscoveryResultPage.getItems(), returns a List containing one of the following types of objects, which are DiscoveryResult instances. DiscoveryResult is a collection of Link instances. PlaceLink - Represents discovery information about a Place. The PlaceLink contains a brief summary about a place. Details about a place are available from the Place that the PlaceLink references. DiscoveryLink - Represents a discovery-related API link used to retrieve additional DiscoveryResultPage. This type of Link can be a result item in an Explore or Here type of search. The DiscoveryLink references refined discovery requests resulting in more specific results. For example, the DiscoveryLink may link to a discovery request to search for 'Eat & Drink', 'Going Out', 'Accommodation', and so on. Since there may be new types of Link items in the future, it is recommended that each type of DiscoveryResult be checked before it is used (as shown in the following code snippet). In the following example, it is shown how a Place is retrieved through a PlaceLink: // Implement a search result listener ResultListener<DiscoveryResultPage> searchlistener = new ResultListener<DiscoveryResultPage>() { public void oncompleted(discoveryresultpage results, ErrorCode error) { if (error == ErrorCode.NONE) { // The results is a DiscoveryResultPage which represents a // paginated collection of items. List<DiscoveryResult> items = results.getitems(); // Iterate through the found place items. for (DiscoveryResult item : items) { // A Item can either be a PlaceLink (meta information // about a Place) or a DiscoveryLink (which is a reference // to another refined search that is related to the // original search; for example, a search for // "Leisure & Outdoor"). if (item.getresulttype() == ResultType.PLACE) { PlaceLink placelink = (PlaceLink) item; // PlaceLink should be presented to the user, so the link can be // selected in order to retrieve additional details about a place // of interest. else if (item.getresulttype() == ResultType.DISCOVERY) { DiscoveryLink discoverylink = (DiscoveryLink) item; // DiscoveryLink can also be presented to the user. // When a DiscoveryLink is selected, another search request should be // performed to retrieve results for a specific category. else { // Handle search request error.
82 User Guide 82 ; // Implement a Place listener for handling user interaction with a displayed PlaceLink class PlaceListener implements ResultListener<Place> { public void oncompleted(place data, ErrorCode error) { if (error!= ErrorCode.NONE) { // Handle error else { // Present the place details to the user. String placename = data.getname(); List<Category> placecategories = data.getcategories(); // Retrieve the place details when the user selects a displayed PlaceLink. private void onplacelinkselected(placelink placelink) { PlaceRequest placerequest = placelink.getdetailsrequest(); if( placerequest.execute(new PlaceListener()) == ErrorCode.NONE ) { // Request successful. Additional work can be done here, however, place details will // be returned in PlaceListener.onCompleted(). else { // Handle the error The Place Class The Place class represents a detailed set of data about a physical place, acting as a container for various attributes, collections of media about a place, and key-value pairs of related places. Places object can belong to a specific Category, and has attributes such as: a unique identifier (ID) a name a list of alternative names(optional) a Location object representing the physical location of the place a List of Category objects that link to the categories assigned to the place a URL to the icon that best represents the place a SupplierLink object containing a link to the supplier's brand icon (optional) a String object containing attribute information (optional) a list of ExtendedAttribute objects a page of Image objects(optional) a list of contacts (optional) a collection of media reviews (optional) a collection of media ratings (optional) an average of user ratings (optional)
83 User Guide a page of Editorial objects (optional) a reference identifier (optional) a map of DiscoveryLink objects specifying related places (optional) 83 Additional Search Requests Additionally, the HERE Places Search API also supports the following related request type: Text suggestion - retrieves a list of suggested search terms that are related to a specified location context and a partial search term. For example, if you make a request with the String "rest" in Berlin, the results will contain search terms such as "Restaurant", "Rest area", and "Restorf, Höhbeck, Germany". To use text suggestions, implement a listener to handle a list of strings and call new TextSuggestionRequest(String) as follows: // Example Search request listener class SuggestionQueryListener implements ResultListener<List<String>> { public void oncompleted(list<string> data, ErrorCode error) { if (error!= ErrorCode.NONE) { // Handle error // else { for (String r : data) { //Process result data try { String term = "rest"; TextSuggestionRequest request = null; request = new TextSuggestionRequest(term).setSearchCenter(myMap.getCenter()); if (request.execute(new SuggestionQueryListener())!= ErrorCode.NONE ) { //Handle request error // catch (IllegalArgumentException ex) { //Handle invalid create search request parameters Directions This section provides an overview of the Directions feature in the HERE SDK. The Directions feature allows developers to define and display routes between a start and a destination point within their application. It supports many navigation options such as toll road preference and transport type.
84 User Guide 84 Route Calculation for Walking, Driving, Or Riding Transit The HERE SDK for Android supports route calculation with multiple waypoints, optimized for walking, driving or public transit. A route describes a path between at least two waypoints, the starting point and the destination, with optional intermediate waypoints in between. Applications can provide route information to users in two ways: a line rendered on a map that displays a connecting path between all waypoints turn-by-turn directions in text format The RouteManager Class The RouteManager class is responsible for calculating a route by using a RoutePlan and a RouteManager.Listener instance. An application can initiate a route calculation by calling the RouteManager.calculateRoute(RoutePlan, Listener) method, providing options and waypoints through RoutePlan, and receive progress updates through the Listener. Applications can call the RouteManager.getInstance() method to retrieve a RouteManager singleton instance. The RoutePlan Class The RoutePlan class is a parameter list that is used for route calculation. A RoutePlan object is comprised of a list of GeoCoordinate objects and an optional RouteOptions object. If a RouteOptions is not specified, default values will be used. Applications can add an individual waypoint to a RoutePlan by passing a GeoCoordinate object to the addcoordinate(geocoordinate) method. The RouteOptions Class The RouteOptions class is a model of the parameters required to calculate one route, encapsulating "building block" parameters for a route such as: The desired number of routes The routing type, such as fastest travel time or shortest distance The mode of transportation, such as by walking or driving The arrival or departure time The maximum number of transit line changes
85 User Guide 85 The allowed types of route segments, such as dirt roads, highways, or ferries Note: The HERE SDK also supports alternate routes between two waypoints. The alternate route feature allows more than one route to be returned after a route calculation. You can use the RouteOptions class to set the desired number of routes, and the HERE SDK will then return different routes according to this limit. Note that the first element of the returned list of RouteResult is the main route, and the rest of the returned routes are not listed in any specific order. The RouteResult Class The RouteResult class represents a route calculation result. Applications can retrieve a Route object and the corresponding set of violated routing conditions using the following methods: getroute() getviolatedoptions() Violated routing options are the conditions that a routing result was unable to adhere to. For example, after specifying a route calculation that avoids tolls and ferries, you may get a RouteResult that contains a Route object along with RouteResult.ViolatedOption.AVOID_TOLL_ROADS. This indicates that although a route was found, this route goes through at least one toll road violating a condition of your route request. The Route Class The Route class is a distinct calculated path connecting two or more waypoints, consisting of a list of maneuvers and route links. By using RouteManager.calculateRoute(RoutePlan, Listener) to trigger a route calculation, your application can use the RouteManager.Listener to monitor the calculation and trigger callback methods. These callback methods have parameters which include a list of the calculated RouteResult objects. Using these RouteResult objects, you can call getroute() to retrieve the routes. A Route object contains route information that can be accessed by calling methods, such as: getrouteplan() - returns the RoutePlan for the route getwaypoints() - returns the array of all waypoints for the route getstart() - returns the starting waypoint for the route getdestination() - returns the destination waypoint for the route getmaneuvers() - returns the array of all maneuvers that travelers will encounter along the route.. getlength() - returns the length of the route, in meters getboundingbox() - returns the smallest GeoBoundingBox that contains the entire route getroutegeometry() - returns the array of all GeoCoordinate values representing, in order, the polyline of the route
86 User Guide 86 getsublegcount() - returns the amount of sub-legs the route has. A sub-leg is the part of a route between two stop waypoints The MapRoute Class The MapRoute class is a type of MapObject that displays a calculated route on a map. Typically, an application will create a MapRoute after a route calculation, passing the relevant Route object as a parameter to the MapRoute(Route) constructor before adding the MapRoute to the map by calling Map.addMapObject(MapRoute). For example, if you want to render a route that connects two waypoints (start and destination), you can add the following application logic: Figure 32: Calculate Route
87 User Guide Get a RouteManager by calling RouteManager.getInstance(). // Declare the rm variable (the RouteManager) and Get the RouteManager RouteManager rm = RouteManager.getInstance(); 2. Create a RoutePlan and add two GeoCoordinate waypoints. // Create the RoutePlan and add two waypoints RoutePlan routeplan = new RoutePlan(); routeplan.addwaypoint(new GeoCoordinate( , )); routeplan.addwaypoint(new GeoCoordinate( , )); 3. Create a new RouteOptions object, set itstype and TransportMode values by calling appropriate RouteOptions methods, and then add it to RoutePlan. // Create the RouteOptions and set its transport mode & routing type RouteOptions routeoptions = new RouteOptions(); routeoptions.settransportmode(routeoptions.transportmode.car); routeoptions.setroutetype(routeoptions.type.fastest); routeplan.setrouteoptions(routeoptions); 4. To make sure route calculation can handle returning a Route object that in turn can be used to create a MapRoute instance for rendering on the map, add an inner class by implementing RouteManager.Listener in the appropriate activity class. private class RouteListener implements RouteManager.Listener { // Method defined in Listener public void onprogress(int percentage) { // Display a message indicating calculation progress // Method defined in Listener public void oncalculateroutefinished(routemanager.error error, List<RouteResult> routeresult) { // If the route was calculated successfully if (error == RouteManager.Error.NONE) { // Render the route on the map maproute = new MapRoute(routeResult.get(0).getRoute()); map.addmapobject(maproute); else { // Display a message indicating route calculation failure 5. After adding the inner listener class (named RouteListener for this example), calculate the route by calling RouteManager.calculateRoute(RoutePlan, Listener) (making use of an instantiated RouteListener object). // Calculate the route rm.calculateroute(routeplan, new RouteListener());
88 User Guide 88 Routing-related Enumerations Route calculations make use of HERE SDK enumerations that include: The RouteOptions.Type enum - represents values describing different routing types, such as FASTEST, SHORTEST, or ECONOMIC The RouteOptions.TransportMode enum - represents values describing different transport modes, such as CAR or PEDESTRIAN The RouteManager.Error enum - represents values describing possible route calculation errors, such as NONE or VIOLATES_OPTIONS The RouteResult.ViolatedOption enum - represents values describing possible route option violations, such as AVOID_HIGHWAYS or AVOID_FERRIES
89 Supplemental Information 89 Chapter 4 Supplemental Information Topics: Creating a Simple HERE SDK Application in Android Studio Compatibility Fragments Size Management Development Tips This section provides supplemental information for using the HERE SDK for Android.
90 Supplemental Information 90 Creating a Simple HERE SDK Application in Android Studio This tutorial provides instructions on how to create a simple application using the HERE SDK for Android in Android Studio. It is equivalent to the Eclipse tutorial, which is located at Creating a Simple Application Using the HERE SDK on page 11. Development tasks for this basic application include: Create a new Android Studio project Add necessary resources, permissions and map fragment(s) to the project properties and application manifest Acquire credentials from HERE for accessing map services Initialize the map fragment such that a map instance is created and associated with the map fragment for rendering on the client device Create a New Android Studio Project The first stage of developing an application using the HERE SDK is to create a new project in Android Studio as follows: 1. From the Welcome to Android Studio dialogue box, select New Project to open the Create New Project dialog 2. In the New Android Application dialog, under Application name, specify an appropriate application name The remainder of this tutorial will refer the application name as HelloHEREMaps. 3. Under Company Domain, specify an appropriate domain. By default, your application package name is composed of Company Domain and Application Name. For example, if mapstutorial.com is your Company Domain, and the Application Name is HelloHEREMaps then the package name is com.mapstutorial.helloheremaps. The package name can also be changed by clicking the Edit link box. 4. Under Project Location, specify an appropriate project location in the file system 5. Click Next 6. Select the form factors your application will run on. For the purpose of this tutorial, check Phone and Tablet. 7. Under Minimum SDK, select the lowest version of the Android SDK you wish to support. For this sample application, we will use Android Click Next
91 Supplemental Information You may be prompted to agree to a License Agreement. Click Accept, and then Next to install SDK components. After the installation is complete, click Next again. 10. In the "Add an activity to Mobile" dialog box, select Blank Activity and click Next 11. In the "Choose options for your new file" dialog box, specify an appropriate activity name in Activity Name. This tutorial will use the name MainActivity. 12. Under Layout Name, specify an appropriate layout name. This tutorial will use activity_main) 13. Under Title, specify an appropriate title. (This tutorial will use MainActivity) 14. Under Menu Resource Name, specify an appropriate menu resource name. (This tutorial will use menu_main) 15. Click Finish Result: Andriod Studio creates the structure for your project and opens the development environment. A few views are available in the Android Studio development environment. The Android View shows a flattened view of the application's structure, and the Project View shows a flattened view of the project's structure, including Gradle-related files. The Android View provides quick access to key source files of your Android application. Selecting the activity_main.xml file in Android View opens the file in the Layout Editor and allows you to dragand-drop widgets into your layout.
92 Supplemental Information 92 The following image shows how to switch between Android and Project view. Figure 33: Switching Views in Android Studio Add HERE SDK Libraries to Your Project After creating the skeleton of your new application, add the HERE SDK resources as follows: 1. From the directory where you installed the HERE SDK, copy the contents of the HERE-sdk/libs/ folder, except the armeabi-v7a folder, to your project's libs/ folder. 2. In your Android Studio project's libs/ folder, right-click the HERE-sdk.jar file and select Add as Library, then under the Add To module, select app and click OK. 3. Optional: If you plan on extending this application with HERE Places functionality, add the googlegson library (release or a compatible version) into your project. One way to do this is to download the google-gson-*-release.zip file from unzip the ZIP archive, and copy the gson-*.jar (not gson-*-sources.jar or gson*-javadoc.jar) into your project libs/ folder, then right-click on it in Android Studio, and select Add as Library, then under the Add To module, select app and click OK. The google-gson
93 Supplemental Information 93 library is required for all HERE Places operations. For more information on using HERE Places, please see Places on page From the directory where you installed the HERE SDK, copy the contents of the HERE-sdk/ libs/armeabi-v7a folder to your project's app/src/main/jnilibs/armeabi folder. You will need to create the jnilibs and armeabi subfolders. 5. From the Android Studio Project View, click.idea> libraries, ensure HERE_sdk_javadoc.xml is not on the list. If it exists, delete HERE_sdk_javadoc.xml. 6. Optional: To enable quick javadoc reference within your Android Studio environment, click on HERE_sdk.xml to edit it, and then add the following after </CLASSES> and before <SOURCES / >: <JAVADOC> <root url="jar://$project_dir$/app/libs/here-sdk-javadoc.jar!/" /> </JAVADOC> Result: Your project will be able to make use of APIs from the HERE SDK. Edit AndroidManifest.xml With resources added to your project, the next stage of creating an application with the HERE SDK is to edit the project's AndroidManifest.xml file to specify Android permissions as follows: 1. From the Android View, under the manifests folder, double-click your project's AndroidManifest.xml file to open it for editing. 2. Add the following markup within the <manifest></manifest> block of tags, before <application></application>: <uses-permission android:name="android.permission.access_fine_location"/> <uses-permission android:name="android.permission.write_external_storage"/> <uses-permission android:name="android.permission.access_network_state"/> <uses-permission android:name="android.permission.change_network_state"/> <uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.access_wifi_state"/> 3. Within the <application></application> block of tags, add the following markup directly beneath the <activity></activity> tag: <meta-data android:name="com.here.android.maps.appid" android:value="your APP ID"/> <meta-data android:name="com.here.android.maps.apptoken" android:value="your APP CODE"/> 4. Replace the YOUR APP ID and YOUR APP CODE strings with appropriate credentials for your application, which you can acquire by contacting your HERE account representative.
94 Supplemental Information 94 Note: All users of the HERE SDK are required to register for a HERE App_Id and App_Code, and to specify those values in their Android manifest XML file. Failure to do so will result in blocked access to certain features and could lead to degradation in the quality of other services. 5. Within the same <application></application> section in your AndroidManifest.xml file, add the following lines: <service android:name="com.here.android.mpa.service.mapservice" android:label="heremapservice" android:process="global.here.map.service.v2" android:exported="true" > <intent-filter> <action android:name="com.here.android.mpa.service.mapservice" > </action> </intent-filter> </service> Result: Your application is now configured to use the minimum Android device permissions that are required by HERE Maps Edit activity_main.xml Along with permissions and credentials, you must add an Android <fragment /> tag to set up the map fragment that your application activity will be associated with. In this section, we will display a text label (generated as part of the default new application) and a map right below label as follows: 1. From the Android View, under the res/layout/ folder of your project, double-click the activity_main.xml file to open it for editing. 2. Ensure that the XML file has <LinearLayout></LinearLayout> as its root element. Depending on your version of Android Studio, this may be a RelativeLayout instead. If that is the case, replace the contents of the file with the following: <LinearLayout xmlns:android=" xmlns:tools=" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" tools:context=".mainactivity" /> </LinearLayout>
95 Supplemental Information Add the following markup beneath the <TextView/> tag: <!-- Map Fragment embedded with the map object --> <fragment class="com.here.android.mpa.mapping.mapfragment" android:layout_width="match_parent" android:layout_height="match_parent"/> Result: When MapFragment is initialized, your application's MainActivity will contain a MapFragment UI element (with the ID mapfragment) that owns a Map object. Initializing the Map Fragment When you have defined the basic layout of the application and acquired necessary permissions, the final step is to initialize the instance of the MapFragment class, thus creating and associating a Map with the MapFragment declared in the activity_main.xml file: From the Android View, double-click the MainActivity.java file to open it for editing. Revise the import statements and functional logic of the MainActivity to look like the following: package com.mapstutorial.helloheremaps; import android.app.activity; import android.os.bundle; import import import import com.here.android.mpa.common.geocoordinate; com.here.android.mpa.common.onengineinitlistener; com.here.android.mpa.mapping.map; com.here.android.mpa.mapping.mapfragment; public class MainActivity extends Activity { // map embedded in the map fragment private Map map = null; // map fragment embedded in this activity private MapFragment mapfragment = null; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // Search for the map fragment to finish setup by calling init(). mapfragment = (MapFragment)getFragmentManager().findFragmentById( R.id.mapfragment); mapfragment.init(new OnEngineInitListener() { public void onengineinitializationcompleted( OnEngineInitListener.Error error) { if (error == OnEngineInitListener.Error.NONE) { // retrieve a reference of the map from the map fragment map = mapfragment.getmap(); // Set the map center to the Vancouver region (no animation) map.setcenter(new GeoCoordinate( , , 0.0), Map.Animation.NONE); // Set the zoom level to the average between min and max map.setzoomlevel( (map.getmaxzoomlevel() + map.getminzoomlevel()) / 2);
96 Supplemental Information 96 else { System.out.println("ERROR: Cannot initialize Map Fragment"); ); Result: You can run your simple application by pressing the key combination Ctrl + R from within Android Studio. The application will render a map retrieved from the HERE servers. When you are running your application on a device, make sure a dataconnection is enabled. Compatibility Fragments The HERE SDK for Android previously provided the MapCompatibilityFragment for applications targeting Android SDK versions to As of HERE SDK version 2.1, this is deprecated and not further supported. It is recommended that developers migrate to use MapFragment, with at least version 4.0 of the Android SDK, as soon as possible. Size Management This section provides tips on reducing the size of the HERE SDK so your application will use less storage on consumer devices. Remove Unused Font Files By default, the HERE SDK for Android includes a number of font files to support different languages. These files may range from a few hundred kilobytes to a few megabytes in size. You can remove unused font files to reduce the size of your HERE SDK-enabled application. To remove HERE SDK font files, perform these steps on your existing application project: 1. From the Eclipse Package Explorer, double-click on the libs folder to reveal its contents
97 Supplemental Information Double-click on the armeabi-v7a folder to reveal its contents Figure 34: Fonts in Eclipse 3. Right-click and delete any unused font files. The optional fonts included in this directory are: libnanumgothicfontpkg.so - Korean libpurearabicfontpkg.so - Arabic libpurechinesefontpkg.so - Chinese libpureindicsouthfontpkg.so - Hindi libpurethaifontpkg.so - Thai Note: Be careful while performing this step. Deleting a file that is not in this list will cause errors in your application. After completing these steps, your application will take up less space when it is installed on a device. The maximum amount that you can save with these steps is approximately 3.5MB.
98 Supplemental Information 98 Development Tips This section provides tips on building your application using the HERE SDK for Android. Lapsed Listeners and Garbage Collection The HERE SDK provides a number of listener interfaces, such as Map.OnSchemeChangedListener, Map.OnMapTransformListener, and MapGesture.OnGestureListener. To use one of these listeners, you are required to implement and create a listener instance, and register it with another object (using a method such as addschemechangedlistener()) in order to be notified when the relevant event occurs. Unfortunately, this coding pattern can also easily lead to the lapsed listener problem, where available memory is used up by listener objects that are not explicitly unregistered and automatically garbage collected. In order to avoid this issue, the HERE SDK, in some cases, accepts listener objects in WeakReference containers. This has the advantage of avoiding lapsed listeners, but it also means that you will need to be aware that registered listeners may be garbage collected. In order to avoid any issues with this design, please be sure to retain a strong reference to your listener instances (for example, by assigning it to a class variable) if you would like to manage its garbage collection lifecycle. The listener object will not be automatically garbage collected as long as a strong reference exists. Working with Getters Please note that classes in the HERE SDK return copies of objects in its getters. For example, MapPolyline.getPolyline() does not return the same GeoPolyline instance that was used to construct the MapPolyline object; instead, a copy of the GeoPolyline is returned. Since this returned object is a copy, you cannot dynamically modify the MapPolyline instance by modifying this object. If you would like to make changes to MapPolyline, you must call setgeopolyline(geopolyline) instead.
99 API Reference 99 Chapter 5 API Reference An API reference is provided separate to this guide. Please contact your HERE representative if it's missing.
HERE SDK for Android. Developer's Guide. Hybrid Plus Version 2.1
HERE SDK for Android Developer's Guide Hybrid Plus Version 2.1 Contents 2 Contents Legal Notices...5 Document Information... 6 Service Support... 7 Chapter1:Overview... 8 What is the HERE SDK for Android?...9
Tutorial #1. Android Application Development Advanced Hello World App
Tutorial #1 Android Application Development Advanced Hello World App 1. Create a new Android Project 1. Open Eclipse 2. Click the menu File -> New -> Other. 3. Expand the Android folder and select Android
Introduction to NaviGenie SDK Client API for Android
Introduction to NaviGenie SDK Client API for Android Overview 3 Data access solutions. 3 Use your own data in a highly optimized form 3 Hardware acceleration support.. 3 Package contents.. 4 Libraries.
Getting Started: Creating a Simple App
Getting Started: Creating a Simple App What You will Learn: Setting up your development environment Creating a simple app Personalizing your app Running your app on an emulator The goal of this hour is
Arduino & Android. A How to on interfacing these two devices. Bryant Tram
Arduino & Android A How to on interfacing these two devices Bryant Tram Contents 1 Overview... 2 2 Other Readings... 2 1. Android Debug Bridge -... 2 2. MicroBridge... 2 3. YouTube tutorial video series
Now that we have the Android SDK, Eclipse and Phones all ready to go we can jump into actual Android development.
Android Development 101 Now that we have the Android SDK, Eclipse and Phones all ready to go we can jump into actual Android development. Activity In Android, each application (and perhaps each screen
ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)
ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) Who am I? Lo Chi Wing, Peter Lecture 1: Introduction to Android Development Email: [email protected] Facebook: http://www.facebook.com/peterlo111
Login with Amazon Getting Started Guide for Android. Version 2.0
Getting Started Guide for Android Version 2.0 Login with Amazon: Getting Started Guide for Android Copyright 2016 Amazon.com, Inc., or its affiliates. All rights reserved. Amazon and the Amazon logo are
Android Application Development: Hands- On. Dr. Jogesh K. Muppala [email protected]
Android Application Development: Hands- On Dr. Jogesh K. Muppala [email protected] Wi-Fi Access Wi-Fi Access Account Name: aadc201312 2 The Android Wave! 3 Hello, Android! Configure the Android SDK SDK
MMI 2: Mobile Human- Computer Interaction Android
MMI 2: Mobile Human- Computer Interaction Android Prof. Dr. [email protected] Mobile Interaction Lab, LMU München Android Software Stack Applications Java SDK Activities Views Resources Animation
ADITION Android Ad SDK Integration Guide for App Developers
Documentation Version 0.5 ADITION Android Ad SDK Integration Guide for App Developers SDK Version 1 as of 2013 01 04 Copyright 2012 ADITION technologies AG. All rights reserved. 1/7 Table of Contents 1.
Mocean Android SDK Developer Guide
Mocean Android SDK Developer Guide For Android SDK Version 3.2 136 Baxter St, New York, NY 10013 Page 1 Table of Contents Table of Contents... 2 Overview... 3 Section 1 Setup... 3 What changed in 3.2:...
2. Click the download button for your operating system (Windows, Mac, or Linux).
Table of Contents: Using Android Studio 1 Installing Android Studio 1 Installing IntelliJ IDEA Community Edition 3 Downloading My Book's Examples 4 Launching Android Studio and Importing an Android Project
Developing an Android App. CSC207 Fall 2014
Developing an Android App CSC207 Fall 2014 Overview Android is a mobile operating system first released in 2008. Currently developed by Google and the Open Handset Alliance. The OHA is a consortium of
Android Development. http://developer.android.com/develop/ 吳 俊 興 國 立 高 雄 大 學 資 訊 工 程 學 系
Android Development http://developer.android.com/develop/ 吳 俊 興 國 立 高 雄 大 學 資 訊 工 程 學 系 Android 3D 1. Design 2. Develop Training API Guides Reference 3. Distribute 2 Development Training Get Started Building
Developing Android Apps: Part 1
: Part 1 [email protected] www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA CS 282 Principles of Operating Systems II Systems
How to develop your own app
How to develop your own app It s important that everything on the hardware side and also on the software side of our Android-to-serial converter should be as simple as possible. We have the advantage that
Developing NFC Applications on the Android Platform. The Definitive Resource
Developing NFC Applications on the Android Platform The Definitive Resource Part 1 By Kyle Lampert Introduction This guide will use examples from Mac OS X, but the steps are easily adaptable for modern
Mobile Application Development
Mobile Application Development (Android & ios) Tutorial Emirates Skills 2015 3/26/2015 1 What is Android? An open source Linux-based operating system intended for mobile computing platforms Includes a
Android Basics. Xin Yang 2016-05-06
Android Basics Xin Yang 2016-05-06 1 Outline of Lectures Lecture 1 (45mins) Android Basics Programming environment Components of an Android app Activity, lifecycle, intent Android anatomy Lecture 2 (45mins)
Advertiser Campaign SDK Your How-to Guide
Advertiser Campaign SDK Your How-to Guide Using Leadbolt Advertiser Campaign SDK with Android Apps Version: Adv2.03 Copyright 2012 Leadbolt All rights reserved Disclaimer This document is provided as-is.
Presenting Android Development in the CS Curriculum
Presenting Android Development in the CS Curriculum Mao Zheng Hao Fan Department of Computer Science International School of Software University of Wisconsin-La Crosse Wuhan University La Crosse WI, 54601
AdFalcon Android SDK 2.1.4 Developer's Guide. AdFalcon Mobile Ad Network Product of Noqoush Mobile Media Group
AdFalcon Android SDK 214 Developer's Guide AdFalcon Mobile Ad Network Product of Noqoush Mobile Media Group Table of Contents 1 Introduction 3 Supported Android version 3 2 Project Configurations 4 Step
Creating a 2D Game Engine for Android OS. Introduction
Creating a 2D Game Engine for Android OS Introduction This tutorial will lead you through the foundations of creating a 2D animated game for the Android Operating System. The goal here is not to create
directory to "d:\myproject\android". Hereafter, I shall denote the android installed directory as
1 of 6 2011-03-01 12:16 AM yet another insignificant programming notes... HOME Android SDK 2.2 How to Install and Get Started Introduction Android is a mobile operating system developed by Google, which
Building Your First App
uilding Your First App Android Developers http://developer.android.com/training/basics/firstapp/inde... Building Your First App Welcome to Android application development! This class teaches you how to
Tutorial: Android Object API Application Development. SAP Mobile Platform 2.3
Tutorial: Android Object API Application Development SAP Mobile Platform 2.3 DOCUMENT ID: DC01939-01-0230-01 LAST REVISED: March 2013 Copyright 2013 by Sybase, Inc. All rights reserved. This publication
ID TECH UniMag Android SDK User Manual
ID TECH UniMag Android SDK User Manual 80110504-001-A 12/03/2010 Revision History Revision Description Date A Initial Release 12/03/2010 2 UniMag Android SDK User Manual Before using the ID TECH UniMag
TomTom PRO 82xx PRO.connect developer guide
TomTom PRO 82xx PRO.connect developer guide Contents Introduction 3 Preconditions 4 Establishing a connection 5 Preparations on Windows... 5 Preparations on Linux... 5 Connecting your TomTom PRO 82xx device
HERE Android SDK. Release Notes. Starter Edition Version 3.1.1
HERE Android SDK Release Notes Starter Edition Version 3.1.1 HERE Android SDK Release Notes 2 Contents Contents Legal Notices...3 Document Information... 4 Overview...5 Target Audience...6 Release Content...7
By sending messages into a queue, we can time these messages to exit the cue and call specific functions.
Mobile App Tutorial Deploying a Handler and Runnable for Timed Events Creating a Counter Description: Given that Android Java is event driven, any action or function call within an Activity Class must
Tutorial: Android Object API Application Development. Sybase Unwired Platform 2.2 SP02
Tutorial: Android Object API Application Development Sybase Unwired Platform 2.2 SP02 DOCUMENT ID: DC01734-01-0222-01 LAST REVISED: January 2013 Copyright 2013 by Sybase, Inc. All rights reserved. This
ELET4133: Embedded Systems. Topic 15 Sensors
ELET4133: Embedded Systems Topic 15 Sensors Agenda What is a sensor? Different types of sensors Detecting sensors Example application of the accelerometer 2 What is a sensor? Piece of hardware that collects
SDK Quick Start Guide
SDK Quick Start Guide Table of Contents Requirements...3 Project Setup...3 Using the Low Level API...9 SCCoreFacade...9 SCEventListenerFacade...10 Examples...10 Call functionality...10 Messaging functionality...10
Android Java Live and In Action
Android Java Live and In Action Norman McEntire Founder, Servin Corp UCSD Extension Instructor [email protected] Copyright (c) 2013 Servin Corp 1 Opening Remarks Welcome! Thank you! My promise
ANDROID APP DEVELOPMENT: AN INTRODUCTION CSCI 5115-9/19/14 HANNAH MILLER
ANDROID APP DEVELOPMENT: AN INTRODUCTION CSCI 5115-9/19/14 HANNAH MILLER DISCLAIMER: Main focus should be on USER INTERFACE DESIGN Development and implementation: Weeks 8-11 Begin thinking about targeted
PubMatic Android SDK. Developer Guide. For Android SDK Version 4.3.5
PubMatic Android SDK Developer Guide For Android SDK Version 4.3.5 Nov 25, 2015 1 2015 PubMatic Inc. All rights reserved. Copyright herein is expressly protected at common law, statute, and under various
Tutorial: BlackBerry Object API Application Development. Sybase Unwired Platform 2.2 SP04
Tutorial: BlackBerry Object API Application Development Sybase Unwired Platform 2.2 SP04 DOCUMENT ID: DC01214-01-0224-01 LAST REVISED: May 2013 Copyright 2013 by Sybase, Inc. All rights reserved. This
Lab 1 (Reading Sensors & The Android API) Week 3
ECE155: Engineering Design with Embedded Systems Winter 2013 Lab 1 (Reading Sensors & The Android API) Week 3 Prepared by Kirill Morozov version 1.1 Deadline: You must submit the lab to the SVN repository
TUTORIAL. BUILDING A SIMPLE MAPPING APPLICATION
Cleveland State University CIS493. Mobile Application Development Using Android TUTORIAL. BUILDING A SIMPLE MAPPING APPLICATION The goal of this tutorial is to create a simple mapping application that
Android Development. Marc Mc Loughlin
Android Development Marc Mc Loughlin Android Development Android Developer Website:h:p://developer.android.com/ Dev Guide Reference Resources Video / Blog SeCng up the SDK h:p://developer.android.com/sdk/
TIBCO Spotfire Automation Services 6.5. User s Manual
TIBCO Spotfire Automation Services 6.5 User s Manual Revision date: 17 April 2014 Important Information SOME TIBCO SOFTWARE EMBEDS OR BUNDLES OTHER TIBCO SOFTWARE. USE OF SUCH EMBEDDED OR BUNDLED TIBCO
Affdex SDK for Android. Developer Guide For SDK version 1.0
Affdex SDK for Android Developer Guide For SDK version 1.0 www.affdex.com/mobile-sdk 1 August 4, 2014 Introduction The Affdex SDK is the culmination of years of scientific research into emotion detection,
Android Studio Application Development
Android Studio Application Development Belén Cruz Zapata Chapter No. 4 "Using the Code Editor" In this package, you will find: A Biography of the author of the book A preview chapter from the book, Chapter
Introduction to Android SDK Jordi Linares
Introduction to Android SDK Introduction to Android SDK http://www.android.com Introduction to Android SDK Google -> OHA (Open Handset Alliance) The first truly open and comprehensive platform for mobile
ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android
Why Android? ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android Dr Dimitris C. Dracopoulos A truly open, free development platform based on Linux and open source A component-based
Tutorial: Android Object API Application Development. SAP Mobile Platform 2.3 SP02
Tutorial: Android Object API Application Development SAP Mobile Platform 2.3 SP02 DOCUMENT ID: DC01939-01-0232-01 LAST REVISED: May 2013 Copyright 2013 by Sybase, Inc. All rights reserved. This publication
Android app development course
Android app development course Unit 6- + Location Based Services. Geo-positioning. Google Maps API, Geocoding 1 Location Based Services LBS is a concept that encompasses different technologies which offer
Android Programming. Høgskolen i Telemark Telemark University College. Cuong Nguyen, 2013.06.18
Høgskolen i Telemark Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics Cuong Nguyen, 2013.06.18 Faculty of Technology, Postboks 203, Kjølnes ring
Mail Programming Topics
Mail Programming Topics Contents Introduction 4 Organization of This Document 4 Creating Mail Stationery Bundles 5 Stationery Bundles 5 Description Property List 5 HTML File 6 Images 8 Composite Images
Homework 9 Android App for Weather Forecast
1. Objectives Homework 9 Android App for Weather Forecast Become familiar with Android Studio, Android App development and Facebook SDK for Android. Build a good-looking Android app using the Android SDK.
Product Guide. 2013 Nintex. All rights reserved. Errors and omissions excepted.
Product Guide [email protected] www.nintex.com 2013 Nintex. All rights reserved. Errors and omissions excepted. Contents Contents... 2 Introduction... 4 1 Understanding system requirements... 5 1.1 Operating
Android Environment SDK
Part 2-a Android Environment SDK Victor Matos Cleveland State University Notes are based on: Android Developers http://developer.android.com/index.html 1 Android Environment: Eclipse & ADT The Android
EZ RMC Remote HMI App Application Guide for Android Devices
EZ RMC Remote HMI App Application Guide for Android Devices The EZ RMC Remote HMI App is an application designed for your Android devices to enable the monitoring and control of your EZTouch HMIs from
Android Programming Basics
2012 Marty Hall Android Programming Basics Originals of Slides and Source Code for Examples: http://www.coreservlets.com/android-tutorial/ Customized Java EE Training: http://courses.coreservlets.com/
Symantec Enterprise Vault
Symantec Enterprise Vault Guide for Microsoft Outlook 2003/2007 Users 10.0 Full Outlook Add-In Symantec Enterprise Vault: Guide for Microsoft Outlook 2003/2007 Users The software described in this book
Android Environment SDK
Part 2-a Android Environment SDK Victor Matos Cleveland State University Notes are based on: Android Developers http://developer.android.com/index.html 1 2A. Android Environment: Eclipse & ADT The Android
Wave 4.5. Wave ViewPoint Mobile 2.0. User Guide
Wave 4.5 Wave ViewPoint Mobile 2.0 User Guide 2014 by Vertical Communications, Inc. All rights reserved. Vertical Communications and the Vertical Communications logo and combinations thereof and Applications
Android Introduction. Hello World. @2010 Mihail L. Sichitiu 1
Android Introduction Hello World @2010 Mihail L. Sichitiu 1 Goal Create a very simple application Run it on a real device Run it on the emulator Examine its structure @2010 Mihail L. Sichitiu 2 Google
Chapter 2 Getting Started
Welcome to Android Chapter 2 Getting Started Android SDK contains: API Libraries Developer Tools Documentation Sample Code Best development environment is Eclipse with the Android Developer Tool (ADT)
To Install EdiView IP camera utility on Android device, follow the following instructions:
To Install EdiView IP camera utility on Android device, follow the following instructions: To install Ediview application, launch Market. (In your Android device s All apps menu). Click magnifier icon
DIGIPASS CertiID. Getting Started 3.1.0
DIGIPASS CertiID Getting Started 3.1.0 Disclaimer Disclaimer of Warranties and Limitations of Liabilities The Product is provided on an 'as is' basis, without any other warranties, or conditions, express
Table of Contents. 1. Content Approval...1 EVALUATION COPY
Table of Contents Table of Contents 1. Content Approval...1 Enabling Content Approval...1 Content Approval Workflows...4 Exercise 1: Enabling and Using SharePoint Content Approval...9 Exercise 2: Enabling
Symantec Enterprise Vault
Symantec Enterprise Vault Guide for Microsoft Outlook 2010/2013 Users 10.0 Full Outlook Add-In Symantec Enterprise Vault: Guide for Microsoft Outlook 2010/2013 Users The software described in this book
Getting Started With Android
Getting Started With Android Author: Matthew Davis Date: 07/25/2010 Environment: Ubuntu 10.04 Lucid Lynx Eclipse 3.5.2 Android Development Tools(ADT) 0.9.7 HTC Incredible (Android 2.1) Preface This guide
Android Tutorial. Larry Walters OOSE Fall 2011
Android Tutorial Larry Walters OOSE Fall 2011 References This tutorial is a brief overview of some major concepts Android is much richer and more complex Developer s Guide http://developer.android.com/guide/index.html
Empowered by Innovation. Setting Up and Using Fax Mail. P/N 1770087 July 2006 Printed in U.S.A.
Empowered by Innovation Setting Up and Using Fax Mail P/N 1770087 July 2006 Printed in U.S.A. This manual has been developed by NEC Unified Solutions, Inc. It is intended for the use of its customers and
IOIO for Android Beginners Guide Introduction
IOIO for Android Beginners Guide Introduction This is the beginners guide for the IOIO for Android board and is intended for users that have never written an Android app. The goal of this tutorial is to
This tutorial assumes that Visual3D has been installed and that a model has been created as described in Tutorial #1.
C-Motion Online Documentation Visual3D : Tutorial : Data Visualization Objectives (# 1318) This tutorial assumes that Visual3D has been installed and that a model has been created as described in Tutorial
Developer's Cookbook. Building Applications with. The Android. the Android SDK. A Addison-Wesley. James Steele Nelson To
The Android Developer's Cookbook Building Applications with the Android SDK James Steele Nelson To A Addison-Wesley Upper Saddle River, NJ Boston «Indianapolis San Francisco New York Toronto Montreal London
Getting Started with Android
Mobile Application Development Lecture 02 Imran Ihsan Getting Started with Android Before we can run a simple Hello World App we need to install the programming environment. We will run Hello World on
Centrify Mobile Authentication Services
Centrify Mobile Authentication Services SDK Quick Start Guide 7 November 2013 Centrify Corporation Legal notice This document and the software described in this document are furnished under and are subject
Scribe Online Integration Services (IS) Tutorial
Scribe Online Integration Services (IS) Tutorial 7/6/2015 Important Notice No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, photocopying,
Android For Java Developers. Marko Gargenta Marakana
Android For Java Developers Marko Gargenta Marakana Agenda Android History Android and Java Android SDK Hello World! Main Building Blocks Debugging Summary History 2005 Google buys Android, Inc. Work on
Operational Decision Manager Worklight Integration
Copyright IBM Corporation 2013 All rights reserved IBM Operational Decision Manager V8.5 Lab exercise Operational Decision Manager Worklight Integration Integrate dynamic business rules into a Worklight
Cloud Administration Guide for Service Cloud. August 2015 E65820-01
Cloud Administration Guide for Service Cloud August 2015 E65820-01 Table of Contents Introduction 4 How does Policy Automation work with Oracle Service Cloud? 4 For Customers 4 For Employees 4 Prerequisites
INTRODUCTION TO ANDROID CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 11 02/15/2011
INTRODUCTION TO ANDROID CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 11 02/15/2011 1 Goals of the Lecture Present an introduction to the Android Framework Coverage of the framework will be
Symantec Enterprise Vault
Symantec Enterprise Vault Guide for Microsoft Outlook 2010/2013 Users 10.0 Full Outlook Add-In Symantec Enterprise Vault: Guide for Microsoft Outlook 2010/2013 Users The software described in this book
Symantec Enterprise Vault
Symantec Enterprise Vault Guide for Microsoft Outlook 2003/2007 Users 9.0 Symantec Enterprise Vault: Guide for Microsoft Outlook 2003/2007 Users The software described in this book is furnished under a
Admin. Mobile Software Development Framework: Android Activity, View/ViewGroup, External Resources. Recap: TinyOS. Recap: J2ME Framework
Admin. Mobile Software Development Framework: Android Activity, View/ViewGroup, External Resources Homework 2 questions 10/9/2012 Y. Richard Yang 1 2 Recap: TinyOS Hardware components motivated design
WatchDox Administrator's Guide. Application Version 3.7.5
Application Version 3.7.5 Confidentiality This document contains confidential material that is proprietary WatchDox. The information and ideas herein may not be disclosed to any unauthorized individuals
Dell Statistica Document Management System (SDMS) Installation Instructions
Dell Statistica Document Management System (SDMS) Installation Instructions 2015 Dell Inc. ALL RIGHTS RESERVED. This guide contains proprietary information protected by copyright. The software described
Android Quiz App Tutorial
Step 1: Define a RelativeLayout Android Quiz App Tutorial Create a new android application and use the default settings. You will have a base app that uses a relative layout already. A RelativeLayout is
Microsoft Dynamics GP. Audit Trails
Microsoft Dynamics GP Audit Trails Copyright Copyright 2007 Microsoft Corporation. All rights reserved. Complying with all applicable copyright laws is the responsibility of the user. Without limiting
AvePoint Timeline Pro 2.0.1 for Microsoft Dynamics CRM. Installation and Configuration Guide
AvePoint Timeline Pro 2.0.1 for Microsoft Dynamics CRM Installation and Configuration Guide Revision F Issued December 2014 Table of Contents About AvePoint Timeline Pro... 3 Required Permissions... 4
Symantec Enterprise Vault
Symantec Enterprise Vault Guide for Mac OS X Users 10.0 Symantec Enterprise Vault: Guide for Mac OS X Users The software described in this book is furnished under a license agreement and may be used only
Easy Manage Helpdesk Guide version 5.4
Easy Manage Helpdesk Guide version 5.4 Restricted Rights Legend COPYRIGHT Copyright 2011 by EZManage B.V. All rights reserved. No part of this publication or software may be reproduced, transmitted, stored
Introduction: The Xcode templates are not available in Cordova-2.0.0 or above, so we'll use the previous version, 1.9.0 for this recipe.
Tutorial Learning Objectives: After completing this lab, you should be able to learn about: Learn how to use Xcode with PhoneGap and jquery mobile to develop iphone Cordova applications. Learn how to use
Android Developer Fundamental 1
Android Developer Fundamental 1 I. Why Learn Android? Technology for life. Deep interaction with our daily life. Mobile, Simple & Practical. Biggest user base (see statistics) Open Source, Control & Flexibility
Publishing KML Services Tutorial
Publishing KML Services Tutorial Copyright 1995-2010 Esri All rights reserved. Table of Contents Tutorial: Publishing a KML service............................ 3 Copyright 1995-2010 ESRI, Inc. All rights
