My goal is simple: have an app "run in the background" (like the game example in the widgets code along sequence, where rangers have their health refill in the background based on a timer), and have my widget show this status.
So far so good, however I would like to achieve this functionality : when tapping on one of the widget's interactable areas, I would like some code in my app to run without launching the app in full screen.
Example : the rangers are regenerating their health. When their health is full, the widget displays a "go to battle" button, and when pressed, this starts a "battle" timer (similar to the "healing" timer). At the end of the battle timer, rangers go back to their healing state. All of this without explicitly opening the game.
So in my use case, I want to be able to press that "to battle!" button and start my Swift code that will update my rangers status, send them to battle and setup new timers. Right now, with my current knowledge, I know I can call an app URL through a widget tap to open my app in a specific location, but that would open it in fullscreen and that's what I want to avoid (I don't want the app to be launched "explicitely" for the end user).
Is there any way for me to achieve this result? Some iOS native way to run an app's code portion in the background? Or to open the app ever-so-briefly and immediately close it (not ideal but could work)?
So far so good, however I would like to achieve this functionality : when tapping on one of the widget's interactable areas, I would like some code in my app to run without launching the app in full screen.
Example : the rangers are regenerating their health. When their health is full, the widget displays a "go to battle" button, and when pressed, this starts a "battle" timer (similar to the "healing" timer). At the end of the battle timer, rangers go back to their healing state. All of this without explicitly opening the game.
So in my use case, I want to be able to press that "to battle!" button and start my Swift code that will update my rangers status, send them to battle and setup new timers. Right now, with my current knowledge, I know I can call an app URL through a widget tap to open my app in a specific location, but that would open it in fullscreen and that's what I want to avoid (I don't want the app to be launched "explicitely" for the end user).
Is there any way for me to achieve this result? Some iOS native way to run an app's code portion in the background? Or to open the app ever-so-briefly and immediately close it (not ideal but could work)?