Allow background task for android deployed app

1 view (last 30 days)
Fabrizio Sera
Fabrizio Sera on 14 May 2020
Answered: Sutanu Maiti on 22 May 2020
Hi everybody, I'm Fabrizio from Italy.
I'm trying to develop an application for Android using the Simulink Support Package.
The application read and log the sensors and thanks the block AHRS of the sensor fusion toolbox return a NED frame and plot the accelretion in this frame on the screen. I future I need to add other features to this.
THE PROBLEM is that when i block the screen or if i Exit the application (no closing it) the application stops to reed sensors and the application is unsufull.
How can I allowed backgroung workint (or multitasking ability) to my deployed Simulink scheme?

Answers (1)

Sutanu Maiti
Sutanu Maiti on 22 May 2020
Once generated app code is exported to Android Studio, you can add/modify the java/xml code (in Android Studio) and run on device (from Android Studio). It will run the Simulink generated Algorithm also under the hood. If you investigate more into main activity class code, you may find the real-time code is being started and stopped from activity's life cycle methods. You can play around there and make it working eveen when app goes to background.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!