sikandernoori / time_change_detector

A flutter plugin to detect change in device time, date and timezone for Android and IOS.
MIT License
1 stars 5 forks source link

java.lang.IllegalStateException: Too many receivers, total of 1000, registered for pid: #9

Open mmahamed opened 4 days ago

mmahamed commented 4 days ago

Hi I'm experiencing an issue with the time_change_detector plugin in my Flutter project. The plugin appears to be calling registerReceiver() multiple times unnecessarily, which eventually leads to the error: java.lang.IllegalStateException: Too many receivers, total of 1000, registered for pid:

This error sometimes happens in some devices. I read the source code. I guess this error happens because of calling registerReceiver() methods every time the app open.

Steps to Reproduce: Initialize the time_change_detector plugin in a Flutter project. Start the application and allow the system time to change. Open and close the app a lot :) Observe the behavior

Expected Behavior: The registerReceiver() method should be called only once,

Actual Behavior: It seems that registerReceiver() is called multiple times without corresponding calls to unregisterReceiver(), eventually leading to the "Too many receivers" error.

Additional Information: Flutter version: 3.24.1 Plugin version: 0.0.3 Device: Samsung A30 with android 10 and some other devices Please let me know if you need any additional information or logs to help resolve this issue. Thank you for your assistance.

Best regards,

mmahamed commented 2 days ago

Actually there is no need to register a receiver manually because you added a to manifest