iosswiftcameraremote-notifications

Make camera light blink after remote notification in Swift


I'm trying to blink camera light when user receives certain remote push notification. Problem is that camera light won't blink if application is in background mode when the notification arrives. How ever, everything works fine if application is in the foreground.

Is there any way I can get it to work even if application is in the background?


Solution

  • Short answer: No

    Why?

    Camera usage is prohibited while in the background.

    Since the torch is managed via AVCaptureDevice, you cannot turn it on in the background.