|
1 | 1 | package com.mapbox.samples; |
2 | 2 |
|
3 | | -//import com.mapbox.matching.v5.MapboxMapMatching; |
4 | | -//import com.mapbox.matching.v5.models.MapMatchingResponse; |
5 | | - |
| 3 | +import com.mapbox.api.matching.v5.MapboxMapMatching; |
| 4 | +import com.mapbox.api.matching.v5.models.MapMatchingResponse; |
| 5 | +import com.mapbox.geojson.Point; |
| 6 | +import com.mapbox.sample.BuildConfig; |
| 7 | +import retrofit2.Call; |
| 8 | +import retrofit2.Callback; |
| 9 | +import retrofit2.Response; |
6 | 10 |
|
7 | 11 | public class BasicMapMatching { |
8 | | -// public static void main(String[] args) { |
9 | | -// |
10 | | -// MapboxMapMatching mapMatching = MapboxMapMatching.builder() |
11 | | -// .accessToken("pk.eyJ1IjoiY2FtbWFjZSIsImEiOiI5OGQxZjRmZGQ2YjU3Mzk1YjJmZTQ5ZDY2MTg1NDJiOCJ9.hIFoCKGAGOwQkKyVPvrxvQ") |
12 | | -// .coordinate(Point.fromLngLat(-117.1728265285492,32.71204416018209)) |
13 | | -// .coordinate(Point.fromLngLat(-117.17288821935652,32.712258556224)) |
14 | | -// .coordinate(Point.fromLngLat(-117.17293113470076,32.712443613445814)) |
15 | | -// .coordinate(Point.fromLngLat(-117.17292040586472,32.71256999376694)) |
16 | | -// .coordinate(Point.fromLngLat(-117.17298477888109,32.712603845608285)) |
17 | | -// .coordinate(Point.fromLngLat(-117.17314302921294,32.71259933203019)) |
18 | | -// .coordinate(Point.fromLngLat(-117.17334151268004,32.71254065549407)) |
19 | | -// .build(); |
20 | | -// |
21 | | -// System.out.println(mapMatching.cloneCall().request().url()); |
22 | | -// |
23 | | -// mapMatching.enqueueCall(new Callback<MapMatchingResponse>() { |
24 | | -// @Override |
25 | | -// public void onResponse(Call<MapMatchingResponse> call, Response<MapMatchingResponse> response) { |
26 | | -// System.out.println(response.body().toString()); |
27 | | -// } |
28 | | -// |
29 | | -// @Override |
30 | | -// public void onFailure(Call<MapMatchingResponse> call, Throwable throwable) { |
31 | | -// System.out.println(throwable); |
32 | | -// } |
33 | | -// }); |
34 | | -// } |
| 12 | + public static void main(String[] args) { |
| 13 | + |
| 14 | + MapboxMapMatching mapMatching = MapboxMapMatching.builder() |
| 15 | + .accessToken(BuildConfig.MAPBOX_ACCESS_TOKEN) |
| 16 | + .coordinate(Point.fromLngLat(-117.1728265285492,32.71204416018209)) |
| 17 | + .coordinate(Point.fromLngLat(-117.17288821935652,32.712258556224)) |
| 18 | + .coordinate(Point.fromLngLat(-117.17293113470076,32.712443613445814)) |
| 19 | + .coordinate(Point.fromLngLat(-117.17292040586472,32.71256999376694)) |
| 20 | + .coordinate(Point.fromLngLat(-117.17298477888109,32.712603845608285)) |
| 21 | + .coordinate(Point.fromLngLat(-117.17314302921294,32.71259933203019)) |
| 22 | + .coordinate(Point.fromLngLat(-117.17334151268004,32.71254065549407)) |
| 23 | + .build(); |
| 24 | + |
| 25 | + mapMatching.enqueueCall(new Callback<MapMatchingResponse>() { |
| 26 | + @Override |
| 27 | + public void onResponse(Call<MapMatchingResponse> call, |
| 28 | + Response<MapMatchingResponse> response) { |
| 29 | + System.out.println(response.body().toString()); |
| 30 | + } |
| 31 | + |
| 32 | + @Override |
| 33 | + public void onFailure(Call<MapMatchingResponse> call, Throwable throwable) { |
| 34 | + System.out.println(throwable); |
| 35 | + } |
| 36 | + }); |
| 37 | + } |
35 | 38 | } |
0 commit comments