Android - Registering a broadcast receiver for two intents?

前端 未结 1 1618
感动是毒
感动是毒 2020-12-31 22:54

I was wondering is it possible to register a broadcast receiver to receive two intents?

My code is as follows:

sipRegistrationListener = new Broadcas         


        
1条回答
  •  清歌不尽
    2020-12-31 23:33

    Don't create your IntentFilter inline, then use the addAction method to add the UNREGISTERED action, i.e.:

    IntentFilter filter = new IntentFilter(SIPEngine.SIP_REGISTERED_INTENT);
    filter.addAction(SIPEngine.SIP_UNREGISTERED_INTENT);
    context.registerReceiver(sipRegistrationListener, filter);
    

    0 讨论(0)
提交回复
热议问题