Calling update() when App is in background

It seems that update() function doesn’t get called when switching to another app. What is the best way to continue updating events even when my application goes background?

Note: I can run audio successfully when it goes background using ofxPd (events are called from within pd, in a separate thread). However I would like to send midi messages to other applications based on events in the application code

Any ideas?

After tweaking a while, It seems, that a custom, separate thread (using ofThread) continues running, even after app goes background. Background Modes must be set to Audio, Airplay and Picture in Picture or Voice over IP in order to run the thread continuously

Great that you got it working. You may already be aware of it but, backgrounding on iOS and Android works very different from each other, so watch out if your thinking about going cross platform with your project. If anyone else run into the same issue I would just like to add this from apples documentation regarding backgrounding:

For tasks that require more execution time to implement, you must request specific permissions to run them in the background without their being suspended. In iOS, only specific app types are allowed to run in the background:

Apps that play audible content to the user while in the background, such as a music player app
Apps that record audio content while in the background
Apps that keep users informed of their location at all times, such as a navigation app
Apps that support Voice over Internet Protocol (VoIP)
Apps that need to download and process new content regularly
Apps that receive regular updates from external accessories
Apps that implement these services must declare the services they support and use system frameworks to implement the relevant aspects of those services. Declaring the services lets the system know which services you use, but in some cases it is the system frameworks that actually prevent your application from being suspended.

1 Like