izumeroot
izumeroot

Reputation: 552

Can I use android intent from firefox extention?

I need send some data from firefox extension to native android application. How can I use intent for this? Is it an api in firefox for this action? Thanks

Upvotes: 3

Views: 935

Answers (2)

Maks
Maks

Reputation: 7945

This is now possible using as an example the code in this add-on

Its done in a very neat way using JNI to access the Android intents Java classes via Firefoxes C++ code.

Upvotes: 3

Wladimir Palant
Wladimir Palant

Reputation: 57691

I don't think you can. Firefox for Android consists of two parts: the Gecko browser engine (native binary, same as for the desktop Firefox) and the Java-based user interface (Android-specific). The two parts are largely independent and communicate via messaging. Extensions run in Gecko, only the Java-based part can use intents however. I looked at the messages that these two parts can exchange and they are all very specific and related to particular browser actions, nothing that would allow using a generic intent.

If the native application is already running you might be able to communicate via TCP sockets. Either the extension or the native application would need to open a server socket on a well-known port that the other party would connect to.

Upvotes: 1

Related Questions