-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StrictMode DiskReadViolation during initialization #46
Comments
Hello @mars885 , |
Hello @mars885, well, seems like you answered your own question. Yes, you should move initialisation to non-UI thread. In your case, the error is a DiskReadViolation which means you are performing a disk read operation on the main thread. This is not recommended because it can block the UI thread and make the app unresponsive. The SharedPreferences operations like get and put are disk I/O operations. If you are calling these operations on the main thread, it will cause this error. To fix this, you should move initialisation to a background thread. Please let us know if this helped. |
Hey. Thanks for an update. The setup guide does not mention clearly what thread a client of your SDK should use to initialize it. Does it make sense to add a mention for that? Apart from that, moving initialization logic on a background thread will fix 1-4, but the problems 5-6 will still remain due to the fact that the SDK listens to the |
Hey @mars885, do you still get the same error messages for 5-6 after doing init fix as I see there still some Preferences error? If not the same, can you maybe share them? Yes, thanks, we might add note to our docs regarding initialisation. |
Hey all.
We are using the
com.infobip:infobip-mobile-messaging-android-chat-sdk:12.6.2
version of the SDK inside our app. During the initialization of the SDK with StrictMode enabled like so:we get the following reports:
We've followed the setup instructions from the README and basically have initialized the SDK from the
Application
class.It takes roughly half a second to initialize the SDK on the UI thread, which is quite a lot.
Can something be done about this in terms of a fix? Should we initialize it on the backgrround thread and will it even work?
Looking forward to hearing from you.
The text was updated successfully, but these errors were encountered: