intro to apps with maps for series 40 (turkish)

37
1 Görkem Ercan (@GorkemErcan) Nokia Nokia Series 40 için Harita ve Lokasyon Uygulamaları Geliştirmek

Upload: microsoft-mobile-developer

Post on 12-Jul-2015

1.024 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: Intro to Apps with Maps for Series 40 (Turkish)

1

Görkem Ercan (@GorkemErcan) Nokia

Nokia Series 40 için Harita ve Lokasyon Uygulamaları Geliştirmek

Page 2: Intro to Apps with Maps for Series 40 (Turkish)

1. Giriş 2. Kurulum 3. Temel Harita işlemleri 4. Harita işaretleri 5. Konum ve Arama Servisleri 6. Konum Belirleme

Ajanda

2

Presenter
Presentation Notes
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
Page 3: Intro to Apps with Maps for Series 40 (Turkish)

Nokia Kütüphanelerine Giriş

3

Page 4: Intro to Apps with Maps for Series 40 (Turkish)

Nokia Harita Uygulama Kütüphaneleri

4

• Maps API for JavaScript

• Nokia Places API (beta)

• Map Image API for HTTP

• Maps API for Qt

• Maps API for Java ME

http://www.developer.nokia.com/Maps/

Page 5: Intro to Apps with Maps for Series 40 (Turkish)

Nokia Java ME Harita Kütüphanesi

5

• MIDP 2.0 ve üstü telefonları destekler

• Series 40 telefonlar için optimize

• Façade Pattern ile alt seviye tüm detayları saklar

• 150 kB büyüklüğünde

• Farklı harita tipleri (Uydu, Alan, Transit vs)

• Polyline, polygon, işaretler gibi harita temel harita

objelerine destek

• Arama, yol tarifi gibi servislere destek

• Genişletilebilir

http://www.developer.nokia.com/Develop/Maps/Maps_API_for_Java_ME/

Presenter
Presentation Notes
http://www.developer.nokia.com/info/sw.nokia.com/id/6bdf62e2-c739-4c29-bd9f-ddf8455f563e/JavaME.html Faç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.
Page 6: Intro to Apps with Maps for Series 40 (Turkish)

Nokia Java ME Harita Kütüphanesi ve Statik Harita Servisleri

6

Statik Servis Nokia Java ME Harita Kütüphanesi

Page 7: Intro to Apps with Maps for Series 40 (Turkish)

Kurulum

7

Page 8: Intro to Apps with Maps for Series 40 (Turkish)

Alışveriş Listesi

8

1. Java Runtime Environment 6

http://www.java.com/en/download/index.jsp

2. Eclipse ve Eclipse MTJ

http://www.eclipse.org/mtj http://www.developer.nokia.com/Resources/Library/Java/#!getting-started/

3. Nokia SDK for Java

http://www.developer.nokia.com/Develop/Java/Tools/

4. Nokia Java ME Harita kütüphanesi http://www.developer.nokia.com/Develop/Maps/Maps_API_for_Java_ME/Getting_started/

Presenter
Presentation Notes
The Examples were built using Nokia SDK 1.0. The API will be integrated into Nokia SDK 2.0
Page 9: Intro to Apps with Maps for Series 40 (Turkish)

Java Harita Kütüphanesi

9

Jar dosyasını indirin http://www.developer.nokia.com/Develop/Maps/Maps_API_for_Java_ME/Getting_started/

Nokia SDK for Java 2.0 içine entegre

Page 10: Intro to Apps with Maps for Series 40 (Turkish)

Eclipse Ayarları

10

Projenize harita kütüphanesini ekleyin.

Page 11: Intro to Apps with Maps for Series 40 (Turkish)

Nokia Developer kaydı

11

Ücretsiz olarak developer.nokia.com adresinde kayıt olun

Page 12: Intro to Apps with Maps for Series 40 (Turkish)

Token ve AppID

12

Her bir uygulamanız için ücretsiz olarak bir App Id and Token alın

https://api.developer.nokia.com/ovi-api/ui/registration

Page 13: Intro to Apps with Maps for Series 40 (Turkish)

Temel Harita İşlemleri

13

Page 14: Intro to Apps with Maps for Series 40 (Turkish)

İlk Haritam

14

5 satırda tam bir harita 1. AppId ve Token’ ı ApplicationContext’e bildir

2. Bir MapCanvas yarat

3. Display.setCurrent() ile görüntüle

Presenter
Presentation Notes
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
Page 15: Intro to Apps with Maps for Series 40 (Turkish)

Farklı Harita Çeşitleri

15

Temel Harita tipleri

Kod

Page 16: Intro to Apps with Maps for Series 40 (Turkish)

Daha Çok Çeşitlerde Harita

16

1) Bir MapSchemeListener yarat ve getAvailableMaps()’i çağır

2) Başarılı veya Hatalı geri dönüşleri işle

1) Geri dönen MapProviders listesine göre BaseMapType belirle

Presenter
Presentation Notes
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.
Page 17: Intro to Apps with Maps for Series 40 (Turkish)

Harita dilleri

17

• 8 farklı dil destekleniyor, henüz Türkçe yok • Arapça, Çince, Almanca, İngilizce,

Fransızca, İtalyanca,Rusça, İspanyolca

• ApplicationContext’ de DefaultLanguage belirlemek yeterli

• Varsayılan dil İngilizce

Page 18: Intro to Apps with Maps for Series 40 (Turkish)

18

• MapDisplay objesinde oluşan olaylardan haberdar olmak için bir MapComponent yaratın

• MapComponent ‘a bir EventListener ekleyin

Haritadaki olaylardan haberdar olmak

Presenter
Presentation Notes
All map objects are created through the MapFactory Default width of a line. zoomTo
Page 19: Intro to Apps with Maps for Series 40 (Turkish)

Harita işaretleri

19

Page 20: Intro to Apps with Maps for Series 40 (Turkish)

Haritada İşaretler

20

• MapStandardMarker • Çeşitli geometrik şekiller ve Balloon • Kolayca yazı eklenebilir, renk belirlenebilir • Varsayılan işaret ‘Nokia Mavisi’ Balloon

• MapMarker

• Genelde resim ikonlar eklemek için kullanılır

• MapFactory kullanarak yaratılırlar

Presenter
Presentation Notes
AMarkers highlight points of interest at a specified location on the map - two types exist: map objects are created through the MapFactory Balloon 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.
Page 21: Intro to Apps with Maps for Series 40 (Turkish)

Polyline ve Polygonlar

21

• MapPolyline birbirine bağlı noktalardan oluşur

• MapPolygon bağlı noktaların arasındaki alandır

• Tüm diğer harita objeleri gibi MapFactory ile yaratılırlar

• Bu objelerindeki GeoBoundingBox sıkça kullanacağınız bir özellikdir

Presenter
Presentation Notes
All map objects are created through the MapFactory Default width of a line. zoomTo
Page 22: Intro to Apps with Maps for Series 40 (Turkish)

MapCanvas MapDisplay MapObject

22

• MapCanvas , MapFactory ve MapDisplay objelerini barındırır • MapFactory tüm MapObject tipindeki objelerin yaratılmasında

kullanılır • MapFactory kullanarak bir MapDisplay yaratabilirsiniz

• MapDisplay kendisi de MapObject tipinde bir objedir • MapObject tipindeki objeler bir MapContainer içinde tutulabilir

Presenter
Presentation Notes
Create MapDisplay explicitly for caching map data
Page 23: Intro to Apps with Maps for Series 40 (Turkish)

Konum ve Arama Servisleri

23

Page 24: Intro to Apps with Maps for Series 40 (Turkish)

Geocode Arama

24

• Adresten harita lokasyonunu arar

• Aramalar senkron veya asenkron olabilir

• Asenkron olanı tercih edin

1. Bir GeoCodeRequestListener yaratın

2. Bir GeoCodeRequest yaratın

3. Başarılı ve başarısız dönüşde ne yapacağınıza karar verin

Presenter
Presentation Notes
Geocoding is Address to Location. Can supply hint – The Toledo problem ( two cities similar size same name) = other example Hamilton. HENCE THE NULL above!
Page 25: Intro to Apps with Maps for Series 40 (Turkish)

Geri Geocode Arama

25

• Coğrafik koordinatlardan adres aramadı. • Aramalar senkron veya asenkron olabilir • Asenkron olanı tercih edin

1. ReverseGeocodeRequestListener yaratın

2. ReverseGeoCodeRequest yaratın

3. Başarılı ve başarısız dönüşde ne yapacağınıza karar verin

Presenter
Presentation Notes
How to get the central point of the map.
Page 26: Intro to Apps with Maps for Series 40 (Turkish)

Yer Arama

26

• Yerel aramalar • Text arama (örnek: “Pizza”) • Kategori arama (örnek: restaurant) • Veya kombinasyonu (örnek: “Cake” + restaurant)

• Detaylı sonuçlar

• Haberleşme bilgileri • Açılış zamanları • Tanımlar, yorumlar • Resimler...

Presenter
Presentation Notes
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?
Page 27: Intro to Apps with Maps for Series 40 (Turkish)

Nasıl Yer Arama Yapılır

27

1. PlaceSearchRequestListener yarat

2. PlaceSearchRequest yarat

3. Başarılı ve başarısız dönüşde ne yapacağınıza karar verin

4. Detaylara Result içinden ulaşabilirsiniz

Page 28: Intro to Apps with Maps for Series 40 (Turkish)

Rota Servisi

28

• Rota Servisi bir veya daha fazla nokta (waypoint) arasında yol bulmak için kullanılır

• Rota servisinden cevap dönmesi zaman alabilir onun için Rota servisi ile asenkron çalışmak daha iyidir

1. RouteListener yarat

2. RouteRequest yarat

3. Başarılı ve başarısız dönüşde ne yapacağınıza karar verin

Page 29: Intro to Apps with Maps for Series 40 (Turkish)

• Routing Type – default is RoutingType.Shortest

• Mode of Transport – default is TransportMode.CAR

• Additional Restrictions – None are selected by default

Rota Servisi

29

• Yol hesaplama yöntemi RoutingMode parametreleri değiştirilerek optimize edilebilir

Page 30: Intro to Apps with Maps for Series 40 (Turkish)

Paylaşma Yöneticisi

30

• RESTful harita kütüphanesi için Kısa ve şifreli URL’ ler oluşturur

• URL SMS veya benzeri bir yöntemle aynı haritayı açmak üzere paylaşılabilir

• İstemci yeteneklerine göre maps.nokia.com veya m.maps.nokia.com açılır

Presenter
Presentation Notes
Synchronous (obviously)
Page 31: Intro to Apps with Maps for Series 40 (Turkish)

Konum belirleme

31

Page 32: Intro to Apps with Maps for Series 40 (Turkish)

Series 40 telefonlar ile konum bulmak

32

• Java uygulamaları JSR-179 Location kütüphanesi ile konum beliryebilirler

• İki şekilde konum belirlenebilir • Cell ID positioning • GPS

• Series 40 telefon GPS pek çok modelde bulunmadığından Cell-ID daha yaygın bir yöntemdir

• Harita kütüphanesinin bir parçası değildir

Page 33: Intro to Apps with Maps for Series 40 (Turkish)

Cell-ID ile konum belirleme

33

• Yöntem bir servise cihazın o anda iletişimde bulunduğu GSM

hücresinin numarasını bildirilmesi ve servisten bunun karşılığında bir coğrafik koordinat alınması ile gerçekleşir

• Bu yöntemin yanılma payı bölgedeki hücre sıklığına göre değişir

0 2000 4000 6000 8000

10000 12000

Urban Suburban Rural

Accu

racy

(met

ers)

Cell-ID accuracy

Page 34: Intro to Apps with Maps for Series 40 (Turkish)

Cell-ID ile Konum Belirleme 1) LocationUtil kullanarak Cell-ID destekleyen bir

LocationProvider yarat Note: getLocationProvider() ikinci parametresini şimdilik null verebilirsiniz.

2) getLocation() çağır ve sonucu işle

QualifiedCoordinate ve GeoCoordinate arasında birebir eşleşme vardır

34

Presenter
Presentation Notes
-1 is the timeout parameterNote: The second parameter of getLocationProvider() is currently always null. This leaves the library open for future extension
Page 35: Intro to Apps with Maps for Series 40 (Turkish)

LocationUtil • Konum belirleme yöntemleri aşağıdaki

gibi kombinasyonlar olabilir

Useful Combinations • Offline Cell ID

• Standalone GPS

• Assisted GPS

• Online Cell ID an/or WLAN

35

Page 36: Intro to Apps with Maps for Series 40 (Turkish)

GPS ile Konum Belirleme

1. Create a GPS LocationProvider

2. Set the provider to start polling

3. Retrieve and process the result

36

Presenter
Presentation Notes
-1 is the timeout parameter The 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.
Page 37: Intro to Apps with Maps for Series 40 (Turkish)

Daha Fazla Bilgi En son SDK ve bilgiler için http://developer.nokia.com Nokia Developer Java dökümanları http://www.developer.nokia.com/Resources/Library/Java Nokia Harita Kütüphaneleri http://developer.nokia.com/Maps Bu webinardaki kod örnekleri https://github.com/gorkem/MapsWebinar Nokia Developer Türkiye http://developer.nokia.com/tr http://facebook.com/NokiaDevTr http://twitter.com/NokiaDevTr

37