How to Install HERE SDK for ANDROID

33
Lonel Labit Manager Regional Map & Content, APAC [email protected] HERE, A Nokia Company HERE SOFTWARE DEVELOPMENT KIT FOR ANDROID

description

(c/o Lonel Labit of Here Maps)

Transcript of How to Install HERE SDK for ANDROID

Page 1: How to Install HERE SDK for ANDROID

Lonel Labit

Manager

Regional Map & Content, APAC

[email protected]

HERE, A Nokia Company

HERE SOFTWARE DEVELOPMENT KIT FOR ANDROID

Page 2: How to Install HERE SDK for ANDROID

What is the HERE SDK for Android?

© 2014 HERE | HERE BRIEFING | COMPANY CONFIDENTIAL

Page 3: How to Install 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.

Page 4: How to Install HERE SDK for ANDROID

What are the Features of the HERE SDK for Android?

© 2014 HERE |

Page 5: How to Install HERE SDK for ANDROID

55

Map Display

• Client-site map rendering using vector data

• Dynamic map download

• 214 countries in

• 54 languages

• Maps preload for offline usage

• Map styles: normal, night, transit etc.

• Map display of >15,000 textured 3D landmarks

• Touch screen gestures: pan, flick, pinch zoom, rotate, tilt etc.

• Map overlay of objects such as polylines, polygons, icons, routes.

• Map overlay of custom raster tiles (e.g. for heat maps)

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

Page 6: How to Install HERE SDK for ANDROID

66

Venue Maps

• Feature rich maps of shopping malls, train stations and airports

• Shading and labeling of detailed spaces (e.g stores, restaurants)

• Indication of facilities including restrooms, ATMs, escalators, elevators, etc.

• Selectable user interface

• Tap-on capability for retrieval of venue information

• Switcher floor capability for venues and display of current floor

• Searchable directory of stores and facilities

• 18,000 venues in 41 countries

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

Page 7: How to Install HERE SDK for ANDROID

77

3D Maps and Street Level Imagery

3D Maps

• 3D map display in 3D

• 3D landmarks display

Street Level Imagery

• Panoramic (360-degree) street level imagery for >90 cities

• Imagery as Internet map enhancement service

• Support for search and visualization use cases

• High-resolution view of key features, tourist attractions, historical locations and commercial centers

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

Page 8: How to Install HERE SDK for ANDROID

88

Traffic

Real-time traffic display on the map

• Traffic flow for >30 countries

• Color coded traffic flow:

Green - Normal

Amber - High

Red - Very High

Black - Stalling

• Traffic incidents for >20 countries

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

Page 9: How to Install HERE SDK for ANDROID

99

Touch screen gestures

HERE SDKs are optimized for touch devices and interfaces supporting a variety of touch gestures:

• Panning or free drag

• Swipe or kinetic flick

• Pinch / spread to zoom

• Single tap

• Double tap

• Two-finger tap

• Two-finger vertical drag

• Two-finger rotate

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

Page 10: How to Install HERE SDK for ANDROID

1010

Directions

• Get driving directions for >90 countries

• Driving directions taking real-time traffic conditions into account

• Pedestrian directions using walkways (e.g. stairs, ramps)

• Public Transit directions using timetables for >400 cities

• Routing options

• type (fastest/shortest)

• avoid options (toll roads, motorways, parks etc.)

• Offline route calculation

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

Page 11: How to Install HERE SDK for ANDROID

1111

Places and Search

Places

• > 75 million places available

• Explore places by categories

• Explore places details (images, ratings, reviews, editorials etc.)

Search

• Geocoding

• Reverse Geocoding

Offline mode for Places search, Geocoding, Reverse Geocoding

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

Page 12: How to Install HERE SDK for ANDROID

12

Hybrid Engine Functionality

• HERE maps rendering independent of data connection

• Map data preload for all countries/regions. Map data is highly compressed vector data => keeping size requirements to a minimum

• E.g. California ~200MB, complete world ~14GB

• HERE Cloud on-demand map data download where map data wasn’t already preloaded

• HERE Cloud on-demand download of non-vector maps such as Satellite and Terrain, Street Level Imagery and custom map stiles - requires data connection

• Route calculation, search for places, geocoding and reverse geocoding capabilities available with no data connection

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

Page 13: How to Install HERE SDK for ANDROID

13

Live Sight

• Track position of device in space and animate view accordingly• Seamless transitions from Map to LiveSight and back again• Gesture support allows the user to interact with content, custom gestures can also be defined• Content transitions and interaction are animated using hardware acceleration• "Radar" UI support, which provides the user with more context regarding their position relativeto content• Highly configurable LiveSight engine allows the user experience to be customized

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

Page 14: How to Install HERE SDK for ANDROID

14

Favourites – Make Your Personal Map on the Go

Collect the places you’d like to visit again as favourites so they are always at your fingertips and finding them is a snap - in any HERE app.

Page 15: How to Install HERE SDK for ANDROID

15

How to get started?

Go to www.developer.here.com

Click Sign in/Register

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

Page 16: How to Install HERE SDK for ANDROID

16

How to get started?

Create an APP

Select:

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

Page 17: How to Install HERE SDK for ANDROID

17

How to get started?

Keep your APP_ID and Code!

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

Page 18: How to Install HERE SDK for ANDROID

18

Download the SDK at this link:

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

http://1drv.ms/Vn9CGG

Page 19: How to Install HERE SDK for ANDROID

19

Serious Coding Stuff…. Coming Ahead…. >_<

HERE Philippines Mapping Operations at San Pablo Laguna.

Page 20: How to Install HERE SDK for ANDROID

20

Creating a Simple Application

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

4 Easy Steps to do this:

Page 21: How to Install HERE SDK for ANDROID

21

Creating a Simple Application

First things first – Setup your emulator

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

Note: Please set a 200-300 MiB SD Card Space

and check User Host GPU

Page 22: How to Install HERE SDK for ANDROID

22

Creating a Simple Application

First things first – Install Mapsservice-release.apkin your android device/emulator

The apk is in the apk folder.

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

Note: The HERE SDK supports Android 2.3.3 or

higher. However, for application targeting

as low as Android SDK version 2.3.3 to 2.3.7,

MapFragment is supported through the use

of com.here.android.mpa.mapping.MapComp

atibilityFragment and the Android

Support Package (

http://developer.android.com/tools/extras/support

-library.html ). For more

details, refer to

http://developer.android.com/tools/extras/support

-library.html#Using

Page 23: How to Install HERE SDK for ANDROID

23

Creating a Simple Application

What do we want to achieve in this topic?

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

• 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

Page 24: How to Install HERE SDK for ANDROID

24

Creating a Simple Application

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

1. From the Eclipse 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 asHelloHEREMaps)

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)

5. Under Minimum Required SDK, select the lowest version of the Android SDK you wish to support.For this sample application, we will use Android 3.0

Page 25: How to Install HERE SDK for ANDROID

25

Creating a Simple Application

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

6. Under Target SDK, select your target Android SDK version with API level 14 (Ice Cream Sandwich4.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.

Page 26: How to Install HERE SDK for ANDROID

26

Creating a Simple Application

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

We need to Add HERE Libraries to the project and add it to the build path

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 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.

Page 27: How to Install HERE SDK for ANDROID

27

Creating a Simple Application

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

We need to Add HERE Libraries to the project and add it to the build path

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.

3. 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"/>

Page 28: How to Install HERE SDK for ANDROID

28

Creating a Simple Application

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

We need to Add HERE Libraries to the project and add it to the build path

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 from developer.here.com when you registered.

Page 29: How to Install HERE SDK for ANDROID

29

Creating a Simple Application

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

We need to Add HERE Libraries to the project and add it to the build path

Edit activity_main.xmlAlong 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 theactivity_main.xml tab to switch the file's view to text editor mode.

Page 30: How to Install HERE SDK for ANDROID

30

Creating a Simple Application

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

We need to Add HERE Libraries to the project and add it to the build path

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="http://schemas.android.com/apk/res/android"

xmlns:tools="http://schemas.android.com/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>

Page 31: How to Install HERE SDK for ANDROID

31

Creating a Simple Application

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

We need to Add HERE Libraries to the project and add it to the build path

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.

Page 32: How to Install HERE SDK for ANDROID

32

Creating a Simple Application

© 2014 HERE | HERE Platform for Business – HERE SDKs for Business | [NAME] | Company confidential

From the Package Explorer, under the src/ folder of your project, double-click theMainActivity.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;

Page 33: How to Install HERE SDK for ANDROID

33

import android.app.Activity;

import android.os.Bundle;

import com.here.android.mpa.common.GeoCoordinate;

import com.here.android.mpa.common.OnEngineInitListener;

import com.here.android.mpa.mapping.Map;

import 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;

@Override

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() {

@Override

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 Angeles (no animation)

map.setCenter(new GeoCoordinate(15.1447, 120.5957, 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");

}

}

});