WebIntent Broadcast receiver ionic 3


#1

How to register the broadcast receiver for webintent.
I am trying to create a global Broadcast receiver which can listen to the broadcast from other android applications.


#2

Found a solution in case anyone needs it…
The direct register method didnt work for me …
this.webIntent.registerBroadcastReceiver this didnt work.

But this works. Using the intentShim and call the register receiver directly.

(<any>window).plugins.intentShim.registerBroadcastReceiver({
      filterActions: ['<mention your actions here>'],
      filterCategories: ['<filter catagories here>']
    }, (intent) => {
       //your code to be executed after the broadcast is received..
    });

mention your actions here : replace this with your actions. It can be a array of actions too.
filter catagories here : replace this with your categories. It can be a array of categories too.