1. Plugin overview

An HTML5 plugin for Apollo Apps is a bundle of HTML/Javascript files, and several assets which will be cached into the app and executed directly in your app.

An HTML5 plugin section will appear as the other sections in your app:

- It will be displayed between the Navigation Bar and the bottom of the screen, or the TabBar, according to the navigation mode you choosed

- By delegating its internal navigation to the app, the plugin will benefit of the same transition effects (horizontal push, modal) than the other sections

- By delegating its cache management and its network interactions, the plugin will be available offline

- It will also have the capability to interact with the rest of the app (send and receive messages)

2. Content of the plugin bundle

Your plugin can contain several types of files:

- An index.html file (mandatory) that will be the plugin's main page

- Other HTML files (optionnal) that would be the plugin's other pages

- Other resource files (optionnal), like images, CSS stylesheets, JS librairies, etc.

All the dependancies to the plugin files have to be made in the current directory (./).

3. How to send and receive message to and from the app

There are two types of interactions possible between your plugin and your Apollo Apps app.

Messages sent by the plugin to the app (Plugin => Native)
The plugin can send messages to the app, by starting a navigation to documented URL schemes. These methods can be used to manage the internal or external navigation of the plugin, to manage the network interactions, and other methods.

Messages sent by the app to the plugin (Native => Plugin)
These are JavaScript methods sent by the app on the plugin. It can be callbacks sent in response to methods called by the plugin, or methods called by the app according to the lifecycle of the app. The plugin has to implement the JavaScript methods of the callback protocol that it needs to handle.

The implementation process of the methods and callbacks of the Apollo Apps Plugin API is described in the article Plugin API Overview.

4. Apollo Apps JavaScript ToolKit

The methods available to discuss with the app (navigation, download, etc.) can be called directly by sending HTTP request to the app.

However, in most cases, you may prefer to use the Apollo Apps JavaScript ToolKit that makes the calls easier, with an encapsulation of the requests into JavaScript functions.

In this documentation, you'll find the method prototypes in the HTTP requests version, and their equivalent in GBJSToolKit.

Did this answer your question?