Skip to content
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

Event of change is duplicated #2

Open
zawadZwd opened this issue Dec 28, 2021 · 3 comments
Open

Event of change is duplicated #2

zawadZwd opened this issue Dec 28, 2021 · 3 comments

Comments

@zawadZwd
Copy link

Hi there
I have some kind of issue with your plugin. When I work on emulator, everything is working perfectly, event starts only when something on contacts list changed.
There is a problem when I am working on real device. I tried on Samsung J6 with Android 10 and Samsung A21 with Android 11.
Event is fired even if I only scrolling around contacts list ( sometimes) or when I changed something in specified contact I get the change event in application 2 times, and when I resume application I can see 4 more event triggers ( every single time ). The difference between events is few milliseconds. Did I something wrong or plugin is too sensitive?
Thank you for any help :)

@deep1931
Copy link

Hi,
Did you get the solution for this?

Thanks.

@Ben-Baert
Copy link
Owner

Hi @zawadZwd and @deep1931 ,

Sorry for the late reply.

I've done some testing and it seems like the change is caused by a sync event also causing one or multiple notifications, and it's not possible to filter these events. The fundamental problem is that the onChange event in the content observer contains meaningful information whatsoever to do any kind of filtering or comparison, so it's not possible to separate meaningful insert/update/delete events from meaningless sync events easily.

I'm going to look into a possible solution in the next couple of days, perhaps by using a timer that ignores the multiple events triggered within a short timespan, or by storing contacts with their version and then doing a comparison.

Ben

@zawadZwd
Copy link
Author

Hey Ben, any luck with that? 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants