crisp-im / crisp-sdk-android

:package: Crisp Android SDK, add a chat in any Android app and communicate with your users.
https://docs.crisp.chat/guides/chatbox-sdks/android-sdk/
Other
55 stars 17 forks source link

Presumably Xiaomi crash on Activity.recreate() #99

Closed Doc1faux closed 2 years ago

Doc1faux commented 2 years ago

Moved from @kastriotrama post in https://github.com/crisp-im/crisp-sdk-android/issues/97#issuecomment-1081763804

Tried it with v3.14.6 but still crashed, updating to the latest v4.9.2 fixed the issue, thank you for your detailed response @Doc1faux

Even though it opens up the activity it throws this exception.

Screen Shot 2022-03-29 at 13 36 05
Doc1faux commented 2 years ago

Moved from @Doc1faux post in https://github.com/crisp-im/crisp-sdk-android/issues/97#issuecomment-1081906359

Do you deploy your app on a Xiaomi device? Because it seems related to a firmware issue on MIUI while calling Activity.recreate() which Crisp SDK does to apply the correct Chat theming according to the website settings. As I don't own a Xiaomi device to reproduce this crash, I could only provide you a workaround I found which seems to work for some people by disabling auto-dark feature, let me know if it works for you :)

Disable auto-dark feature

Set forceDarkAllowed to false to your app theme and to CrispTheme

 <resources xmlns:tools="http://schemas.android.com/tools">
   <style name="Theme.MyApplication" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
     <item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
   </style>

   <style name="CrispTheme" parent="Theme.AppCompat.Light.DarkActionBar">
     <item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
   </style>
 </resources>
Doc1faux commented 2 years ago

I've just ordered a Xiaomi Redmi 9A which should be shipped with the Android & MIUI versions which crashes. I'll try it when I receive it.

Doc1faux commented 2 years ago

The workaround does not seem to work but this exception does not cause a "real" crash any way and as it is a known issue tied to Xiaomi's firmware, we cannot do anything :/ So I close the issue.