My provider implemented additional authentication to Tile Services by adding an additional queryString parameter, such that each web request will need to be made with ?key=******* (see example here). I am currently unable to use this service in the Android SDK, since I do not believe the Classes expose a way to modify the request url directly.
For example, for WmtsLayer I initialize it like this:
val wtmsBaseMap = WmtsLayer( "https://api.hkmapservice.gov.hk/ogc/wmts/basemap/WGS84/1.0.0/WMTSCapabilities.xml?key=***********", "MapAPI_HKBasemapService", ) val basemap = Basemap(wtmsBaseMap)
This allows me to obtain the Capabilities configuration, but all the subsequent tile requests fail with 401 as they do not use the queryString ?key=****** .
WebTiledLayer is the exception as it seems to work as it directly takes the url input from the constructor. But obviously it suffers from many drawbacks such as lack of caching and configuration options. Ideally I would want other services to work as well.
Is there any way for me to implement this myself, or if not can support for custom queryStrings be added?
Solved! Go to Solution.