0
votes

I am using the android-sdk-legacy SDK of Mapbox which is not supported. The access token from the Mapbox Website is not fetching the tiles.

Purpose: It supports clustered markers on the Mapbox.

Error: Could not fetch tiles because it could not validate Certificate and it was expired on 14Dec 2015.

Does it mean that this SDK can't be used at all? Also, can I use the SDK and host my own map server using Mapbox-gl-native for Android

Please Help.

Okay, this was the basic implementation of the Mapbox 0.7.4 version

EDIT:

public class MainDiscoverFragment extends android.app.Fragment{

private MapView mapView ;

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    return inflater.inflate(R.layout.fragment_main_discover, container, false) ;
}

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    init(view) ;
    setInit() ;


    LatLng location = new LatLng(20.593684, 78.9628800) ;
    mapView.getOverlays() ;
    Marker marker = new Marker(mapView, "Abhinav Das", "Active 10hours ago", location) ;
    mapView.addMarker(marker);
}

private void init(View view) {
    mapView = (MapView) view.findViewById(R.id.discover_mapview) ;
}

private void setInit() {
    MapView mapView = new MapView(getActivity());
    mapView.setAccessToken(getResources().getString(R.string.mapbox_access_token));
    mapView.setTileSource(new MapboxTileLayer("mapbox.streets"));
}
}
1

1 Answers

0
votes

You should still be able to use the Android Legacy SDK. Can you make sure you are using the correct style URL? I'm using the old SDK in one of my apps and it still works fine. Have you checked your account at Mapbox.com?

Heres how I setup the mapview within my app:

MapView mv = (MapView) this.findViewById(R.id.mapview);
mv.setCenter(new LatLng(29.7199489, -95.3422334));
mv.setZoom(17);
mv.setScrollableAreaLimit(scrollLimit);
mv.setMinZoomLevel(16);
mv.setMaxZoomLevel(21);

and within the layout I want to include the map I add this:

<com.mapbox.mapboxsdk.views.MapView
            android:id="@+id/mapview"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            mapbox:mapid="{username}.{mapid}"
            mapbox:accessToken="Your access token here"/>

You can get your mapid from your map style within old Mapbox editor

If you post some of your code, I might be able to spot any errors if any and i'll edit this answer.

Hope this helps!