I have an Android application which streams pictures of maps via a UDP socket to an external embedded device. Therefore, I created a foreground service (the map streaming should run in the background in order to work also when another app is in front or the screen is switched off) which instantiates a MapSnapshotter
. So far everything works fine.
I would now like to add annotations (e.g. lines or icons like a current position marker) to the snapshotter. However, the interface of MapSnapshotter
is quite limited. I would be able to edit the style JSON manually, adding the customized sources and layers I need, and setting the style directly with setStyleJson
. But that makes the snapshotter reloading the whole style again, which is very slow (in my setup, it takes about 1 second), which does not fit with my requirements. Of course, another possibility is to draw the lines/icons directly in the bitmap returned by the snapshotter, but this is very limited (e.g. I cannot draw below the text) and gets complicated when the map is tilted.
Does anybody have experience with this problem or has an idea how to solve it? Perfect would be if I could use the Mapbox annotation plugin. Unfortunately, to instantiate an annotation manager like SymbolManager
I need a MapView
/MapboxMap
. I assume that internally MapSnapshotter
also holds some kind of MapboxMap
, but it's definitely not accessible through the public interface. Any help is highly appreciated!