Closed Martijn0405 closed 1 month ago
This issue has been labeled as type: bug
. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.
Android restarts activities on configuration changes.
Capacitor handles some cases, but looks like navigation
is needed on some Android devices for not restarting the activity on bluetooth connection/disconnection.
I've updated your sample app with a fix, since the Capacitor fix will be on the android-template and won't have any effect on existing apps, only on newly created apps
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.
Capacitor Version
6.0.0
Other API Details
Platforms Affected
Current Behavior
I have a React, NextJS, and Capacitor app built and running on my Android device. When I pause the app by going to the home screen and then open the app again, nothing happens and the app gets resumed without restarting or crashing (as expected). But when I go to the home screen, connect a Bluetooth device, and then open the app, it gets destroyed, crashes, and restarts the app.
The Bluetooth device I am connecting is an iRig BlueTurn, which acts as a BlueTooth Low-Energy (BLE) keyboard.
Expected Behavior
The expected behavior would mean the app no longer crashes after a Bluetooth device gets connected or disconnected.
Project Reproduction
https://github.com/Martijn0405/ble-crash-frontend
Additional Information
Install the app by running
npm i
, thennpm run app
. Connecting a BLE device crashes the app, and immediately restarts it, which updates the time on the home page.