Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit 034bcc9

Browse files
author
Michal Murín
authored
Merge pull request #64 from sygic-travel/STA-445-prepare-release-0.3.0-beta
STA 445 prepare release 0.3.0-beta
2 parents 316e904 + 2ba35b2 commit 034bcc9

File tree

1 file changed

+46
-6
lines changed

1 file changed

+46
-6
lines changed

README.md

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Sygic Travel Android SDK is a framework for embedding a rich set of Sygic Travel data within your
55
application. 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 {
3636
Add dependency to your application module `build.gradle` file:
3737
```gradle
3838
dependencies {
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

7172
This 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)
7374
which 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
8587
PlaceQuery placeQuery = new PlaceQuery();
@@ -105,8 +107,34 @@ Callback<List<Place>> placesCallback = new Callback<List<Place>>() {
105107
StSDK.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+
108134
Since 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
112140
protected 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

123161
Class | 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
134174
This SDK is available under the [MIT License](http://www.opensource.org/licenses/mit-license.php).

0 commit comments

Comments
 (0)