Interacting with Dolphin Browser

In the above code sample, notice that the onBrowserConnected and onBrowserDisconnected methods both take a browser object as an argument.  This object is the Dolphin browser that’s running on the device, that loads your Add-on by declaring an Android intent.

Your Add-on uses this browser object to interact with the Dolphin browser and/or webpages displayed in the browser.

Accessing the browser

A few quick notes about the browser object:

  • To get the browser’s PID (process ID), call browser.getBrowserPid()
  • To use the browser object in other parts of the Add-on app, such as Activity, use the browser’s PID. Call AddonService.getInstance().getBrowser(int pid)

The API version

To find out the Dolphin API version, call Browser.getApiVersion().  This allows the Add-on to take advantage of new features as they are added to the API, while maintaining backward compatibility to earlier API versions.