VoiSmart / pjsip-android

SIP Service for Android based on PJSIP
http://www.pjsip.org/
Apache License 2.0
290 stars 140 forks source link

Send implicit broadcast if explicit fails #159

Closed aenonGit closed 2 years ago

Miha-x64 commented 2 years ago

The for-loop left is nonsense now.

aenonGit commented 2 years ago

Why? If it finds matches it will add the component to it

Miha-x64 commented 2 years ago

It calls setComponent rewriting value from the previous iteration. This means that, if any matching receiver is registered in Manifest, the broadcast will be explicitly routed to one of these manifest receivers.

aenonGit commented 2 years ago

yes but in reality there should be only one matching receiver. Anyway if you have a better approach it will be very welcome :)

Miha-x64 commented 2 years ago

It's a normal situation when there's one receiver in Application which listens for incoming calls and one in call Activity listening to call state. It's better to remove the loop with setComponent() at all.

aenonGit commented 2 years ago

but that's not the case, because there should be only one matching receiver registered in the manifest (which listens to incoming/outgoing/missed calls) all the other receivers (e.g. call state) are not receiving broadcast through the explicit one. If look at it, the "sendExplicitBroadcast" is used only in those three cases and it matches only explicitly registered receiver in the manifest