Portal Builder
A class used to create Portal instances. It follows a Builder Pattern and can be used in situations where you want to programmatically create a Portal at runtime instead of using one directly in an XML layout.
Example usage (kotlin):
val portal: Portal = PortalBuilder("myPortal")
.addPlugin(MyCapacitorPlugin::class.java)
.setPortalFragmentType(MyFadeInOutPortalFragment::class.java)
.setInitialContext(mapOf("myVariableFromAndroid" to 42))
.setStartDir("web_app")
.create()
Example usage (java):
Portal portal = new PortalBuilder("myPortal")
.addPlugin(MyCapacitorPlugin.class)
.setPortalFragmentType(MyFadeInOutPortalFragment.class)
.setInitialContext(Map.of("myVariableFromAndroid", 42))
.setStartDir("web_app")
.create();
Constructors
Functions
Add an Asset Map to the Portal used with shared assets.
Add a plugin to be loaded with the Portal.
Add a plugin instance to be loaded with the Portal.
Creates the Portal instance from the current state of the PortalBuilder provided. This finishes building the Portal.
Set a list of AssetMap to the Portal used with shared assets.
Set development mode on the Portal which will look for a server URL set by the Portals CLI. This is set to true by default but can be turned off manually if desired.
Set the LiveUpdate config if using the Live Updates SDK with Portals.
Set a list of Capacitor Plugin to be loaded with the Portal.
Set the PortalFragment class used with displaying the Portal when added to an XML layout.
Set the directory of the Portal. This directory is the on device directory of where your web application is located.