capacitor-community / bluetooth-le

Capacitor plugin for Bluetooth Low Energy
MIT License
274 stars 79 forks source link

fix(android): register state receivers as REGISTER_EXPORTED #663 #667

Closed peitschie closed 1 month ago

peitschie commented 1 month ago

I haven't got many devices to test this on currently, but this should be the code change needed here.

pwespi commented 1 month ago

Thank you @peitschie for looking into this. However I cannot reproduce the problem described in https://github.com/capacitor-community/bluetooth-le/issues/663. Do you have a case where that crash happened?

pwespi commented 1 month ago

@allcontributors please add @peitschie for code and question

allcontributors[bot] commented 1 month ago

@pwespi

I've put up a pull request to add @peitschie! :tada:

peitschie commented 1 month ago

@pwespi huh... you are 100% correct here.

I'd seen this on at least one of the registerReceivers on another plugin, and assumed it applied more widely than it actually does.

There is a carved out exception for System Broadcasts when using a Context#registerReceiver call: https://developer.android.com/about/versions/14/behavior-changes-14#system-broadcasts which looks like it covers all the usages you have here.

This change isn't necessary at all. Sorry for the wasted time.