Intro to apps with maps for series 40
Upcoming SlideShare
Loading in...5
×
 

Intro to apps with maps for series 40

on

  • 2,144 views

Consumers are looking for location-based apps to make their Series 40 phones smarter, easier to use, and more relevant to their mobile lives. Learn how to easily integrate Nokia Maps and services into ...

Consumers are looking for location-based apps to make their Series 40 phones smarter, easier to use, and more relevant to their mobile lives. Learn how to easily integrate Nokia Maps and services into your apps targeting Series 40 phones.

Statistics

Views

Total Views
2,144
Views on SlideShare
2,144
Embed Views
0

Actions

Likes
0
Downloads
56
Comments
1

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • You can find a recording of Jason's presentation at: http://forumnokia.adobeconnect.com/p621b221h1x/
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Intro – Why bother?Prereqs - What you need to get started how to get a basic map up on screen.Basic– blobs on the map - this is where the code will get started.Routing, search are included in the API
  • http://www.developer.nokia.com/info/sw.nokia.com/id/6bdf62e2-c739-4c29-bd9f-ddf8455f563e/JavaME.htmlFaçade Pattern - hides all the “plumbing” code - the low level connection calls, image manipulation etc. leaving a simple and consistent interface so you don’t need to reinvent the wheel.
  • Does all the hard bits so you don’t have to bother.
  • The Examples were built using Nokia SDK 1.0.The API will be integrated into Nokia SDK 2.0
  • If phone supports landscape, map will display as landscape.Nokia-MIDlet-App-Orientation: landscape JAD file.You will want http permission javax.microedition.io.Connector.http
  • Why bother? – could use alternate maps – e.g. small text “Standard Web” versions.Easter Egg maps – e.g. Low Glare “Night Mode”. Recommendation – have a fallback.
  • All map objects are created through the MapFactoryBalloon is the classic blob on the map. The right size for a thumb.Probably want to retain a reference to the marker. (When I Click on X do Y) getObjectsAt()Don’t make icons too small. Png for transparency.Readability of text – wouldn’t recommend it. Less is more . Use tooltip to get feedback.
  • All map objects are created through the MapFactoryDefault width of a line.zoomTo
  • Cust
  • All map objects are created through the MapFactoryDefault width of a line.zoomTo
  • Search/Places Routing make requests to online REST services, an interpret the result.Sharing is a URL minfying service for nokia maps – allows the return of an image.
  • Geocoding is Address to Location.Can supply hint – The Toledo problem ( two cities similar size same name) = other example Hamilton. HENCE THE NULL above!
  • How to get the central point of the map.
  • A general places search - What is there to see and do around here?   A category-based places search - What restaurants are there within walking distance of here?A text based search – Is there a Chinese restaurant within walking distance?An in depth search – Is that Chinese restaurant within walking distance, open at this time of night, and is it any good?
  • Synchronous (obviously)
  • -1 is the timeout parameter
  • -1 is the timeout parameterThe major difference between these two methods, is that the values of the interval update and time out parameters are set in a different way. In the first example both parameters are passed as arguments to the setLocationListener() method, while in the second example, the interval value is indirectly set by forcing the running thread to sleep for the given time, and the time out parameter is passed as argument when calling the getLocation() method. When frequent location queries are needed, setting a Location Listener should be preferred compared to repeatedly calling the getLocation() method for the following reasons: a) The call to getLocation() generates screen prompts because it requires the user's permission to query the location information. The same applies for the setLocationListener() method. The difference is, that the former is called continuously within the loop, thus making it impractical to use, unless the application is signed, while the latter is called only once. Note that whether the getLocation() method requires signing, in order not to prompt for the location retrieval, depends on the permission level needed per device. Using the setLocationListener() method, ensures that there are minimal prompts without the need to sign the application among the largest set of devices possible. b) By using the setLocationListener() method, it is possible for the implementation to reuse location results if it already has a recent location result when the update is due to be delivered. This is done by passing an additional argument, the maxAge parameter that defines how old the location result is allowed to be, when the update is made. However when the application needs to retrieve the device's location only once, the getLocation() method should be preferred. This is due to simplicity in the implementation. If the setLocationListener() method was preferred in this case, some additional logic would be needed so that the location listener was replaced by another one that does not listen for location updates, as soon as a valid location has been retrieved once. Otherwise, even if the application ignored the location updates provided by the locationUpdated() method, those would still run in the background, causing increased usage of battery power.

Intro to apps with maps for series 40 Intro to apps with maps for series 40 Presentation Transcript

  • Nokia Series 40Application Development withNokia Maps and Location APIsfor Series 40Jason FoxTechnical Support EngineerMaps Platform1 © Nokia 2012 Intro to Maps on Apps.pptx
  • Agenda1. Introduction to Nokia Maps API for Java ME2. Getting Started - Prerequisites3. Basic Mapping Concepts4. An Introduction to the Search and Routing Services5. An Introduction to positioning (JSR-179)2 © Nokia 2012 Intro to Maps on Apps.pptx
  • Nokia Maps API for Java ME3 © Nokia 2012 Intro to Maps on Apps.pptx
  • What is Nokia Maps API for Java ME?• API aimed at Series 40 Phones. Allows you to develop mobile applications based on Nokia Maps.• Façade Pattern - hides all the “plumbing” code - the low level connection calls, image manipulation etc.• Targets devices supporting MIDP 2.0 or higher.• Not currently part of the SDK• Single downloadable JAR around 150 kB.• Faster App development. Better App performanceFull details at :http://www.developer.nokia.com/Develop/Maps/Maps_API_for_Java_ME/ 4 © Nokia 2012 Intro to Maps on Apps.pptx
  • Why use Nokia Maps API for Java ME?• Multiple map types optimised for mobile displays• Low latency and reduced network traffic compared with static map image solutions.• “Out-of-the box” support for common mapping use cases (Markers, Images, Polygons, Polylines, Pan and Zoom)• In-built libraries to access search, routing and POI information services.• Map Components are open to extension - ability to customise and override standard API functionality.• Advanced Features as standard, such as KML parsing and the addition of custom overlays 5 © Nokia 2012 Intro to Maps on Apps.pptx
  • Comparison of Nokia Maps for JavaME vs. Static Map Image SolutionsStatic Map (e.g. RESTful Map API)• one single http request per map ->one single image returned in response• new request for each alteration.Maps for Java ME• multiple http requests for individual map tiles.• Map tiles are cached.• Map tiles stitched together and objects added to display result on screen• Additional requests only made if necessary. Result • Reduced latency and lowered network traffic though built-in intelligent map rendering, caching and tiling = Better for Mobile. 6 © Nokia 2012 Intro to Maps on Apps.pptx
  • Prerequisites7 © Nokia 2012 Intro to Maps on Apps.pptx
  • Prerequisites1. Install a Java Runtime Environment 6 http://www.java.com/en/download/index.jsp2. Install an IDE (e.g. NetBeans) Netbeans.org3. Install a Nokia SDK for Java (free) http://www.developer.nokia.com/Develop/Java/Tools/ 8 © Nokia 2012 Intro to Maps on Apps.pptx
  • Prerequisites 1.4. Configure Nokia SDK in NetBeans 2. 3. 9 © Nokia 2012 Intro to Maps on Apps.pptx
  • Prerequisites5. Download the binary Jar http://www.developer.nokia.com/Develop/Maps/Maps_API_for_Java_ME/Getting_started/ 10 © Nokia 2012 Intro to Maps on Apps.pptx
  • Prerequisites6. Register as a developer free at www.developer.nokia.com 11 © Nokia 2012 Intro to Maps on Apps.pptx
  • Prerequisites7. Obtain a free set of authentication credentials (App Id and Token) from: https://api.developer.nokia.com/ovi- api/ui/registration − A unique App ID and Token, are required for each application8. After creating a new NetBeans project, You must add a reference to the Nokia Maps API binary jar itself - Maps_API.jar. This reference is added under the ”Resources” folder in theNetBeans project. 12 © Nokia 2012 Intro to Maps on Apps.pptx
  • Basic Mapping Concepts• The Minimal Map• An Introduction to Map Types• Map Languages• Markers• Polylines and Polygons• Interaction13 © Nokia 2012 Intro to Maps on Apps.pptx
  • The Minimal MapA Pannable Zoomable Map in five lines of code 1. Set credentials in the ApplicationContext 2. Create a MapCanvas 3. Set it as the current Display 14 © Nokia 2012 Intro to Maps on Apps.pptx
  • Map TypesPick the right map type for your app 15 © Nokia 2012 Intro to Maps on Apps.pptx
  • Map Types – Simple MethodThe Standard Map SchemesThe Code16 © Nokia 2012 Intro to Maps on Apps.pptx
  • Map Types – Advanced Method1) Implement a MapSchemeListener and call getAvailableMaps()2) Handle Success and Failure3) Set the BaseMapType from MapProviders received 17 © Nokia 2012 Intro to Maps on Apps.pptx
  • Map Languages• Currently eight map Languages available Arabic, Chinese, German, English, French, Italian, Russian and Spanish• Just set the DefaultLanguage in the ApplicationContext• By default Maps are displayed in English18 © Nokia 2012 Intro to Maps on Apps.pptx
  • Map MarkersMarkers highlight points of interest at a specified locationon the map - two types exist:• MapStandardMarker • Various Geometric Shapes plus Balloon • Easy to add text, change color (and opacity)• MapMarker • Used to add graphical icons. • Need to define an anchor point.• Use the MapFactory to created instances of MapStandardMarkers and MapMarkers• Default marker is a ‘Nokia Blue’ Balloon 19 © Nokia 2012 Intro to Maps on Apps.pptx
  • Polylines and Polygons• A MapPolyline is a series of connected points• A MapPolygon is the area within a closed loop of points• Every instance of a MapPolygon or MapPolyline is created using the MapFactory• Both objects have an implicit GeoBoundingBox. 20 © Nokia 2012 Intro to Maps on Apps.pptx
  • MapCanvas MapDisplay MapObject• MapCanvas holds a MapFactory and a MapDisplay• Use the MapFactory to create MapObjects• Can also use MapFactory to create a MapDisplay directly e.g. for automatic caching of Static Maps• The MapDisplay contains MapObjects but is also a MapObject itself.• MapObjects may be also be contained within a MapContainer21 © Nokia 2012 Intro to Maps on Apps.pptx
  • Map Events • Create a MapComponent to interact with your MapDisplay • Add an EventListener to your MapComponent to receive notifications of screen interactions and key presses22 © Nokia 2012 Intro to Maps on Apps.pptx
  • An Introduction to Location-Based Services • Search (Geocoding and Reverse Geocoding) • Places Search • Routing • Sharing23 © Nokia 2012 Intro to Maps on Apps.pptx
  • Geocoding Search• Finds a location on the Map from a given Address• Search can be either synchronous or asynchronous.• Asynchronous search is preferred.1. Implement a GeoCodeRequestListener2. Create a GeoCodeRequest3. Handle Success or Failure24 © Nokia 2012 Intro to Maps on Apps.pptx
  • Reverse Geocoding Search • Finds the Address for a given geographic location. • Search can be either synchronous or asynchronous. • Asynchronous search is preferred. 1. Implement a ReverseGeocodeRequestListener 2. Create a ReverseGeoCodeRequest 3. Handle Success or Failure25 © Nokia 2012 Intro to Maps on Apps.pptx
  • Places Search• Flexible Local Search • General Text Search (e.g. “Pizza”) • Category Search (e.g. restaurant) • Combined Search (e.g. “Italian” + restaurant)• Drill down to get more details • Contact Details • Opening Times • Description and Reviews • Images etc.26 © Nokia 2012 Intro to Maps on Apps.pptx
  • Places Search 1. Implement a PlaceSearchRequestListener 2. Create a PlaceSearchRequest 3. Handle Success or Failure 4. More details can be obtained by interrogating the Result27 © Nokia 2012 Intro to Maps on Apps.pptx
  • Routing Service • Routing Service consists of creating a route between two or more Waypoints. • Responses from the Routing service can take time. Make your RouteRequests asynchronously. 1. Implement a RouteListener 2. Create a RouteRequest 3. Handle Success or Failure28 © Nokia 2012 Intro to Maps on Apps.pptx
  • Routing Service • The preferred route calculation can be optimized by altering the parameters of the RoutingMode • Routing Type – default is RoutingType.Shortest • Mode of Transport – default is TransportMode.CAR • Additional Restrictions – None are selected by default29 © Nokia 2012 Intro to Maps on Apps.pptx
  • Sharing Manager • Creates short encrypted URLs for the RESTful Maps API • Send URL as an SMS for a client to receive a static map. • Service forwards to maps.nokia.com or m.maps.nokia.com on capable browsers30 © Nokia 2012 Intro to Maps on Apps.pptx
  • Positioning• Separate Optional Package for Positioning (JSR-179)• Frequently combined with the Nokia Maps API for Java ME, though not part of the API itself• Two location methods maybe available • Cell ID positioning • GPS31 © Nokia 2012 Intro to Maps on Apps.pptx
  • Cell-ID Location• A MIDlet can obtain an approximate position using the Cell-ID location method.• The method consists of passing the ID of the cell the device is currently connected to, on to a look-up service. The service will then return the well-known position of the given cell-ID.• This Cell ID location provides a method of positioning mobile devices which do not contain a GPS unit.Note: the degree of uncertainty can vary of a few meters to hundreds ofkilometers, depending upon the infrastructure of the local network and thedata available to the look-up service for that region 32 © Nokia 2012 Intro to Maps on Apps.pptx
  • Cell-ID Example1) Create a Cell-ID LocationProvider using LocationUtils Note: The second parameter of getLocationProvider() is currently always null. This leaves the library open for future extension2) Make a call to getLocation() and process the resultThe attributes of the QualifiedCoordinate class map directly onto theGeoCoordinate class.Set up a loop and poll to obtain location updates. 33 © Nokia 2012 Intro to Maps on Apps.pptx
  • LocationUtil• The preferred Location method(s) can be any combination of the methods defined in JSR-179:Useful Combinations• Offline Cell ID• Standalone GPS• Assisted GPS• Online Cell ID an/or WLAN34 © Nokia 2012 Intro to Maps on Apps.pptx
  • GPS Example1. Create a GPS LocationProvider2. Set the provider to start polling3. Retrieve and process the result 35 © Nokia 2012 Intro to Maps on Apps.pptx
  • For More Information Download the latest Nokia SDK for Java http://developer.nokia.com Consult the Nokia Developer Library http://library.developer.nokia.com Nokia Maps API http://developer.nokia.com/Maps36 © Nokia 2012 Intro to Maps on Apps.pptx