0

I am trying to use Google Roads api, in which want to call a method snapToRoads, but I am facing an issue.

I tried to use other method of snapToRoads, but it also shows same error

LatLng[] page = latLngs
            .subList(lowerBound, upperBound)
            .toArray(new LatLng[upperBound - lowerBound]);
SnappedPoint[] points = RoadsApi.snapToRoads(context, true, page).await();

RoadsApi.snapToRoads(context, true, page)

shows... "Cannot resolve method snapToRoads(..,...,...)'"

I believe i have added the necessary dependencies in app level gradle :

implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.maps:google-maps-services:0.9.3'    
implementation 'com.google.maps.android:android-maps-utils:0.5'

If there is any other dependency which i have not added then please let me know.

Import statements have also been added in my Activity:

import com.google.maps.GeoApiContext;
import com.google.maps.RoadsApi;
import com.google.maps.model.SnappedPoint;

Link which i have referred to: roads-api-samples

16
  • what is context in your code? Commented Jul 5, 2019 at 12:38
  • @GhostCat I meant i am trying to use RoadsAPi in which i have that method call... Commented Jul 5, 2019 at 12:42
  • @VladyslavMatviienko GeoApiContext is the context Commented Jul 5, 2019 at 12:42
  • Are you using it from an activity or a fragment Commented Jul 5, 2019 at 12:49
  • @trinadhthatakula I have used an Activity Commented Jul 5, 2019 at 12:50

0