Closed yannolaf closed 7 years ago
how to send message from native code?
LocalBroadcastManager.getInstance(this).sendBroadcastSync(intent);
Keep in mind that the plugin registers the handler using
LocalBroadcastManager.getInstance(super.webView.getContext()).registerReceiver(receiver,filter);
The broadcast is send from an other application. Is received by my application see ActivityManager log.
Is there a working sample application where I can take a look?
Currently the plugin doesn't manage external broadcast events but only the local ones
Probably solution could be handle the external event in android and then fire it up to javascript
take a look here
As soon as possible I'll provide you an example on that
Try this and let me know
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<receiver android:name="MyReceiver" >
<intent-filter>
<action android:name="com.android.action.SEND_SCAN_RESULT" >
</action>
</intent-filter>
</receiver>
</application>
public class MyReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
LocalBroadcastManager.getInstance(context).sendBroadcastSync(intent);
}
}
Great! Thanks for the solution :)
I am trying to use this plugin to receive android broadcast intents. I register for the broadcast event
but if the intent gets fired
the callback does not get triggered.
The only log message is
do I have to add anything to the Android Manifest file?