Open laurentlr opened 5 months ago
Hey @laurentlr. Thank you for reaching out and sharing your feedback. Because push notifications can be received when the app is in killed state and the OS can limit resources and code execution while the app is still in the background, to prevent metrics from being ignored, we process them to store and ensure they are not lost, hence resulting in the violation.
I agree this isn't ideal behavior and we have noted this down and do have plans to improve it. While I can't share specific time frame for the improvement to be released at the moment, I can confirm that it's something we have under consideration.
Thanks for sharing. Please don't hesitate to ask any further questions or share more feedback. Your input is important for us to improve our product. Thank you for sharing, and have a great day.
Hi @mrehan27, I'm reproducing this issue when app is in foreground (haven't tried with app killed).
we process them to store and ensure they are not lost
That's fine, but this storage processing should be done on the IO thread (like any storage in general) and not on the main thread.
Thanks for the confirmation @laurentlr. It indeed will be reproducible when the app is in foreground because the code executed when push is received is same in both app opened and killed states.
I agree this should not be done on main
thread. However, the change may not be as trivial as it looks since this will make the code run asynchronously and not return results instantly. To avoid any unwanted bugs, we need to ensure we improve this without affecting any of the current behavior.
Having said that, I do want to reconfirm that this is noted and something we plan to include in our roadmap this year. However, we are not working on this actively so I can't confirm any expected date for the changes at this moment.
We'll keep you posted about any progress on this. Thanks again for highlighting and sharing the details.
@mrehan27 This is not the only one you have, your ktor client also introduces StrictMode policy violation: android.os.strictmode.UntaggedSocketViolation: Untagged socket detected; use TrafficStats.setTrafficStatsTag() to track all network usage
When using Strict mode, I recommend that you handle this as it affects ANR scores for applications on google score, it might seem small, but for low-end devices this has an effect.
@Syrou, Thanks for reaching out and sharing the details. This is a helpful insight, and appreciate you highlighting the challenges. I'll bring this again to the team to reconsider and prioritize. If you have more insights or examples, please feel free to share them here as they'll help us with better prioritization.
We'll keep this thread updated with any progress. Thanks again for your patience and understanding!
SDK version: 3.10.0 Environment: Development & Production
Are logs available?
Describe the bug With StrictMode enabled, when sending a push notification, we can see DiskReadViolation. It's coming from your class
CustomerIOCloudMessagingReceiver
To Reproduce
Expected behavior There should not be any DiskReadViolation on main thread.