44Sygic Travel Android SDK is a framework for embedding a rich set of Sygic Travel data within your
55application. It gives you an access to millions of places covering the whole world.
66
7- For further details see [ Full SDK documentation] ( http://docs.sygictravelapi.com/android-sdk/master ) .
7+ For further details see [ Full SDK documentation] ( http://docs.sygictravelapi.com/android-sdk/0.3.0-beta ) .
88
99## Requirements
1010
@@ -36,7 +36,7 @@ repositories {
3636Add dependency to your application module ` build.gradle ` file:
3737``` gradle
3838dependencies {
39- compile ('com.sygic.travel:sdk:0.2 .0-beta@aar'){
39+ compile ('com.sygic.travel:sdk:0.3 .0-beta@aar'){
4040 transitive=true;
4141 }
4242}
@@ -57,6 +57,7 @@ dependencies {
5757
5858* API key* must be provided, otherwise every ` StSDK ` get method call will result in an error.
5959
60+ ** Java/Kotlin:**
6061``` java
6162// initialize SDK - in onCreate() method of your Application class or a launcher Activity
6263// Insert real API key instead of YOUR_API_KEY in the line below. The API key can be
@@ -69,7 +70,7 @@ To obtain your *API key* contact us at https://travel.sygic.com/b2b/api-key.
6970## Usage Introduction
7071
7172This example shows how to use the SDK to fetch a representative set of data. To define a set of places
72- you need to create a [ placeQuery] ( http://docs.sygictravelapi.com/android-sdk/0.2 .0-beta/com/sygic/travel/sdk/model/placeQuery/Query.html )
73+ you need to create a [ placeQuery] ( http://docs.sygictravelapi.com/android-sdk/0.3 .0-beta/com/sygic/travel/sdk/model/placeQuery/Query.html )
7374which describes the places which will be fetched - see
7475[ API documentation] ( http://docs.sygictravelapi.com/0.2/#section-places ) .
7576
@@ -80,6 +81,7 @@ Let's define a set of places we want:
8081- marked with category _ Sightseeing_
8182- only the _ Top 10_ of them
8283
84+ ** Java:**
8385``` java
8486// Create placeQuery to get top 10 sightseeings in London
8587PlaceQuery placeQuery = new PlaceQuery ();
@@ -105,8 +107,34 @@ Callback<List<Place>> placesCallback = new Callback<List<Place>>() {
105107StSDK . getInstance(). getPlaces(placeQuery, placesCallback);
106108```
107109
110+ ** Kotlin:**
111+ ``` kotlin
112+ // Create placeQuery to get top 10 sightseeings in London
113+ val placeQuery = PlacesQuery ()
114+ placeQuery.levels = listOf (" poi" )
115+ placeQuery.categories = listOf (" sightseeing" )
116+ placeQuery.parents = listOf (" city:1" )
117+ placeQuery.limit = 10
118+
119+ // Create Callback
120+ private val placesCallback = object : Callback <List <Place >? > () {
121+ override fun onSuccess (data : List <Place >? ) {
122+ // success
123+ }
124+
125+ override fun onFailure (t : Throwable ) {
126+ // something went wrong
127+ }
128+ }
129+
130+ // Perform placeQuery
131+ StSDK .getInstance().getPlaces(query, placesCallback)
132+ ```
133+
108134Since the SDK uses RxAndroid it is important to unsubscribe an observable, when an activity comes
109- to background:
135+ to background.
136+
137+ ** Java:**
110138``` java
111139@Override
112140protected void onPause() {
@@ -117,18 +145,30 @@ protected void onPause() {
117145}
118146```
119147
148+ ** Kotlin:**
149+ ``` kotlin
150+ override fun onPause () {
151+ super .onPause()
152+
153+ // Observables need to be unsubscribed, when the activity comes to background
154+ StSDK .getInstance().unsubscribeObservable()
155+ }
156+ ```
157+
120158## Basic Classes
121- For more details check our [ documentation] ( http://docs.sygictravelapi.com/android-sdk/0.2 .0-beta ) .
159+ For more details check our [ documentation] ( http://docs.sygictravelapi.com/android-sdk/0.3 .0-beta ) .
122160
123161Class | Description
124162:-------------------|:---------------------
125163** ` StSDK ` ** | Singleton instance for fetching data
126164** ` Callback<T> ` ** | Callback class with ` onSuccess(T data) ` and ` onFailure(Throwable t) ` methods. ` T ` is a generic type.
127- ** ` Query ` ** | Entity used when querying for ` Places `
165+ ** ` PlaceQuery ` ** | Entity used when querying for ` Places `
128166** ` Place ` ** | Basic ` Place ` entity
129167** ` Detail ` ** | Detailed object including additional ` Place ` properties, extends ` Place `
130168** ` Medium ` ** | Basic ` Medium ` entity
131169** ` Reference ` ** | External ` Reference ` link
170+ ** ` TourQuery ` ** | Entity used when querying for ` Tours `
171+ ** ` Tour ` ** | Basic ` Tour ` entity
132172
133173## License
134174This SDK is available under the [ MIT License] ( http://www.opensource.org/licenses/mit-license.php ) .
0 commit comments