Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Novfensec
Copy link
Contributor

Fix BroadcastReceiver

@Novfensec Novfensec changed the title Fix broadcast reciever Fix broadcast receiver Jun 30, 2025
@kuzeyron kuzeyron added recipe core-providers Core code that's not a recipe labels Jun 30, 2025
@AndreMiras
Copy link
Member

Interesting that we got two PR the same day for that issue, refs #3167, is it a recent regression?
@Sahil-pixel could you give that one a try and tell us if that fixed it for you?

@Sahil-pixel
Copy link
Contributor

Sahil-pixel commented Jul 1, 2025

Interesting that we got two PR the same day for that issue, refs #3167, is it a recent regression? @Sahil-pixel could you give that one a try and tell us if that fixed it for you?

I have to check this version. I will know you.

But Mine one #3167 is working fine I have tested on Android 14 . No crash on_pause on_reaume of java thread on Android

Copy link
Contributor

@kuzeyron kuzeyron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions to add.

self.handlerthread.start()

if self._is_registered:
print("[BroadcastReceiver] Already registered.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better with a logger instead of print.

self.context.unregisterReceiver(self.receiver)
self._is_registered = False
except Exception as e:
print("[BroadcastReceiver] unregisterReceiver failed:", e)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better with a logger instead of print.

Handler = autoclass('android.os.Handler')

if hasattr(self, 'handlerthread') and self.handlerthread.isAlive():
print("HandlerThread already running, skipping start")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better with a logger instead of print.

@Novfensec
Copy link
Contributor Author

Suggestions to add.

logger = logging.getLogger("BroadcastReceiver")
logger.setLevel(logging.DEBUG)

This.

@kuzeyron
Copy link
Contributor

Suggestions to add.

logger = logging.getLogger("BroadcastReceiver")
logger.setLevel(logging.DEBUG)

This.

Can you update the PR with these changes?

@Novfensec
Copy link
Contributor Author

Suggestions to add.

logger = logging.getLogger("BroadcastReceiver")
logger.setLevel(logging.DEBUG)

This.

Can you update the PR with these changes?

Yepp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-providers Core code that's not a recipe recipe
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants