You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Pathshare** is a realtime location sharing platform. For more information please visit the [Pathshare Developer Page](https://pathsha.re/professional/developers).
7
10
@@ -26,11 +29,11 @@
26
29
27
30
The installation of the `PathshareSDK` is simple. Download the latest `pathshare-sdk-android-[version].zip` from [Releases](https://github.com/freshbits/pathshare-sdk-android/releases), unzip and copy the `repo` folder into the root of your project.
28
31
29
-
Next, reference the `repo` folder in your application `build.gradle` file:
32
+
Next, reference the `PathareSDK` folder in your application `build.gradle` file:
In order to react to the expiration of the session, add an `ExpirationListener`:
130
178
179
+
###### Java
131
180
```java
132
181
session =newSession.Builder()
133
182
// ...
@@ -140,10 +189,19 @@ session = new Session.Builder()
140
189
.build();
141
190
```
142
191
192
+
###### Kotlin
193
+
```kotlin
194
+
session =Session.Builder()
195
+
// ...
196
+
.setSessionExpirationListener { // ... }
197
+
.build()
198
+
```
199
+
143
200
#### Destination
144
201
145
202
Optionally, you can add a destination to the session. Sessions with destination will show the estimated time of arrival (ETA) for each user. The destination identifier is used to group sessions by destination.
146
203
204
+
###### Java
147
205
```java
148
206
Destination destination = new Destination.Builder()
149
207
.setIdentifier("W2342")
@@ -157,24 +215,47 @@ session = new Session.Builder()
157
215
.build();
158
216
```
159
217
218
+
###### Kotlin
219
+
```kotlin
220
+
val destination =Destination.Builder()
221
+
.setIdentifier("W2342")
222
+
.setLatitude(47.378178)
223
+
.setLongitude(8.539256)
224
+
.build()
225
+
226
+
session =Session.Builder()
227
+
// ...
228
+
.setDestination(destination)
229
+
.build()
230
+
```
231
+
160
232
### JoinSession
161
233
162
234
To join the session you created, call the `joinUser()` method on the session object:
163
235
236
+
###### Java
164
237
```java
165
238
session.join(new ResponseListener() { ... });
166
239
167
240
session.isUserJoined() // => true
168
241
```
169
242
243
+
###### Kotlin
244
+
```kotlin
245
+
session.join(object:ResponseListener { ... })
246
+
247
+
session.isUserJoined // => true
248
+
```
249
+
170
250
This call will add your Pathshare user to the session and you will be able to see his location on a map in realtime in the PathshareProfessional web interface.
171
251
172
252
### Invite customer
173
253
174
254
To invite a customer to the session, call the `inviteUser()` method on the session object:
This call will create a customer user andreturn an invitation URL that can be sent to the customer using your preffered channel. The customer will then see the driver's location in realtime as well as the ETA in a white-labeled view with your corporate identity.
191
286
192
287
The customer will be able to enjoy the full realtime experience in the web browser of their smartphone:
@@ -197,14 +292,21 @@ The customer will be able to enjoy the full realtime experience in the web brows
197
292
198
293
In order to stop sending user location and remove the user from the session, call the `leaveUser()` method:
199
294
295
+
###### Java
200
296
```java
201
297
session.leave(new ResponseListener() { ... });
202
298
```
203
299
300
+
###### Kotlin
301
+
```kotlin
302
+
session.leave(object: ResponseListener { ... })
303
+
```
304
+
204
305
### Find Session
205
306
206
307
To find an existing session, use the `findSession()` method with the corresponding session identifier:
207
308
309
+
###### Java
208
310
```java
209
311
Pathshare.client().findSession(identifier, new SessionResponseListener() {
210
312
@Override
@@ -218,3 +320,14 @@ Pathshare.client().findSession(identifier, new SessionResponseListener() {
0 commit comments