#Android App Crashes on Relaunch When a Foreground Service is Running

5 messages · Page 1 of 1 (latest)

hybrid badger
#

We've developed a screen-sharing app using Tauri that relies on a foreground service to continue screencasting even when the app is in the background. It’s common for the operating system to terminate the MainActivity when the app is in the background, but the service continues to run and send screencast frames to the Rust backend.

The issue arises when we relaunch the app: the Tauri application attempts to recreate the webview, leading to an exception (details provided in the attached text file). I am also sharing the complete logs for additional context.

What is the best practice for handling app relaunches in scenarios where the app's lifecycle extends beyond that of the MainActivity?

smoky fjord
#

Can you please open a github issue in the tauri repository with these logs, cargo tauri info output and ideally a simple reproduction repository. Thanks!
I am not super involved in the android part but sounds like a bug in Tauri.

hybrid badger
#

Hi @smoky fjord , thanks for the quick response! I'll go ahead and create the issue, along with a repository for the sample app shortly.

In the meantime, could you help connect us with someone from the Android working group who might assist in finding a workaround? We suspect that tying tauri init to the Activity might not be ideal, and it might be more reliable if initialized at the Application level instead. Thanks again!

smoky fjord
#

we don't have a working group specific to Android, so github issue will be the fastest way

hybrid badger
#

got it! thanks