mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.35k stars 1.33k forks source link

Creating a MapSnapshot from the background #16517

Open georgbachmann opened 3 years ago

georgbachmann commented 3 years ago

For my App I have a counterpart watch app. It would be great to show the user a map of where he is. As there is not native watchOS framework from what I have seen, it would be nice to make a snapshot of a map on the counterpart phone and send it as an image to the watch. That works well, as long as the phone is in foreground. As soon as the phone goes into background mode, the snapshot is not working any more.

Is this on purpose? And is there a way around that problem?

Steps to reproduce

  1. Make your app go into background (hit the home button)
  2. Try to make a map-snapshot. The completion block will never be called.

Expected behavior

Completion getting called with a proper map-snapshot

Actual behavior

Completion is not getting called

Configuration

Mapbox SDK versions: 6.0 iOS/macOS versions: iOS 13.6 Device/simulator models: iPhone X Xcode version: 11.6

hactar commented 3 years ago

I'd like to see this too - with Widgets coming to iOS, creating snapshots in the background would be very useful. My guess is that because iOS doesn't allow OpenGL things to run in the background, Mapbox can't do its snapshot thing in the background either...