setInitialContext

fun setInitialContext(initialContext: Any): PortalBuilder

Sets the initial context to pass to the web view. You can pass in either a Map or a String that will be parsed into a JSON object.

Example usage with a Map (kotlin):

val map: Map<String, Any> = mapOf(
"foo" to "bar",
"ionic" to "portals"
"num" to 42
)

builder = builder.setInitialContext(map)

Example usage with a String (kotlin):

builder = builder.setInitialContext("{\"foo\": \"bar\"}")

Example usage with a Map (java):

Map<String, Object> map = Map.ofEntries(
new AbstractMap.SimpleEntry<String, @NotNull Object>("foo", "bar"),
new AbstractMap.SimpleEntry<String, @NotNull Object>("ionic", "portals"),
new AbstractMap.SimpleEntry<String, @NotNull Object>("num", 42)
);

builder = builder.setInitialContext(map);

Example usage with a String (java):

builder = builder.setInitialContext("{\"foo\": \"bar\"}");

Return

the instance of the PortalBuilder with the initial context set

Parameters

initialContext

the initial context to add to the Portal