Transform request tiles for android
Hey. I'm using mapbox with my own tile server. I need to add header ( better approach ) or send parameter to url in each tile requests ( .pbf ). i have tried put my own token in Mapbox.getInstance(context , accessToken) with prefix ".pk" ( for ensure that pass the token validation method ) and i have seen that in other class ( HttpRequestUrl ) that make the provided request , mapbox uses another method to check the hostname should start with mapbox :
private static boolean isValidMapboxEndpoint(String host) {
return host.equals("mapbox.com")
|| host.endsWith(".mapbox.com")
|| host.equals("mapbox.cn")
|| host.endsWith(".mapbox.cn");
}
So i couldn't send my token in tile request.
Is there any way to let me add header or send some parameters in url ?
Steps to reproduce
1.Add token in Mapbox.getInstance() 2. 3.
Expected behavior
Send puted token in each tile request.
Actual behavior
Nothing sent because of checking url to start with mapbox.
Configuration
**Android versions:8.0.0 **Device models:Xiaomi Mi Mix **Mapbox SDK versions: 8.0.0 ( latest version till now )
two options: FileSource#setResourceTransform or use a custom OkHttpClient (on which you can interceptors) through HttpRequestUtils#setOkHttpClient.