PortalManager

A class used to create and manage Portal instances. It follows a Singleton Pattern to allow access to any ./portal from anywhere in the application.

Example usage (kotlin):

PortalManager.newPortal("my_portal")
.addPlugin(MyCapacitorPlugin::class.java)
.setPortalFragmentType(MyFadeInOutPortalFragment::class.java)
.setInitialContext(mapOf("myVariableFromAndroid" to 42))
.setStartDir("web_app")
.create()

Example usage (java):

PortalManager.newPortal("my_portal")
.addPlugin(MyCapacitorPlugin.class)
.setPortalFragmentType(MyFadeInOutPortalFragment.class)
.setInitialContext(Map.of("myVariableFromAndroid", 42))
.setStartDir("web_app")
.create();

Functions

Link copied to clipboard

Adds a Portal to the Portal Manager. This is not necessary if the Portal is created using the newPortal function.

Link copied to clipboard

Returns a Portal object given the name of the portal. If the portal does not exist, an exception is thrown.

Link copied to clipboard

Check if Portals has been successfully registered with a valid key.

Link copied to clipboard

A helper function to build portal classes and add them to the manager. Classes built with newPortal are added to the PortalManager automatically.

Link copied to clipboard

Validate this copy of Portals with an API key. This function works offline and only needs to be run once before creating your first Portal.

Link copied to clipboard

Removes the Portal from the Portal Manager. The Portal will be returned if it was present. If not, null is returned. Note: if the Portal uses Live Updates and registered an instance on creation, the Live Update instance for the app is not removed.

Link copied to clipboard

Get the number of Portals managed by the Portal Manager.