How to detect interaction of the widget's toggle at locked device

https://developer.apple.com/documentation/WidgetKit/Adding-interactivity-to-widgets-and-Live-Activities#Add-a-toggle

Before explaining the situation, I referred to this document.

I'm making a widget with a toggle that works with Intent. (To be precise, it's Live Activity, but Apple's literally toggling and button interaction are implemented in the same way)

If you press the toggle when the device is locked, the toggle represents the state. However, as described at the top of the same document, the device must be unlocked to execute Intent, so I can't actually change the data.

That's fine, but how can I return the isOn of the toggle to false? I'm blocked here because no code is executed.

If it is a widget in the home screen, it will be basically unlocked, so I can proceed according to the method of the document, but if it is today's view, user can access it even if device is locked.

I tested it in today's view with the Reminders app, If I don't unlock the device after tapping the toggle it returns the toggle back to false state.

I wonder how I can achieve this. Is there an API that I missed?

Summary.

  1. Tap the toggle of the widget while the device is locked.
  2. The device waits for unlocking, but the user cancels it without unlocking it. (Still locked)
  3. Return the isOn of the toggle to false. <- The part I want.

There's no supported way for you to set the state with the APIs currently available. If you'd like us to consider adding the necessary functionality, please file an enhancement request using Feedback Assistant. Once you file the request, please post the FB number here. If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?

FB15675524

How to detect interaction of the widget's toggle at locked device
 
 
Q