Unpreventable Acitivity re-creation on physical keyboard connection change #15720
Description
Hi everyone,
whenever I plug in a physical keyboard (USB/Samsung-POGO/Bluetooth) my applications activity is re-created. This behaviour is expected and there is a known fix for it: Adding ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden
to the MainActivity
as per the following SO Post: https://stackoverflow.com/questions/18444476/android-crashes-on-keyboard-plugging
Expected behaviour: The Activity is not recreated an there is no interuption of the users interaction with the app.
Actual behaviour: The Activity is recreated
To recreate this issue: I recommend to create a blank project. Launch the MainPage as NavigationPage and add a Button to it. Then create a new empty page and navigate to it. This makes the recreation very visible as after the re-creation the navigation root is shown. This also represents the situation in my app very closely.
So far I did a lot of research on this, although I have no native android development experience. There also seems to be a surprising amount of other, commercial Apps that also crash on this configchange.
Thanks in advance, feel free to ask for more info