simply integrated geckoview, a firefox webview component.
-
create a GeckoConfigurer object, and use
addExtensionDependencyto add a component that you want to call through web application. If you not pass a name for the dependency, then lower case of the first letter of class name will be used. Which name will be used in later. -
write your own function to export to the website. the function defines the shape that you want web to call it; inside the function, pass a
NativeMessageobject defined at type.d.js to invoke the callNative function thus send the message to the native. -
in
NativeMessageclass, there's some parameters that you need attention.- extensionName: this is the name of dependencies that you added by
GeckoConfigurer, native message handler use this to identify which dependency would be used. - action: after use
extensionNameto find the specific extension, then the name of method as same as action will be invoked. - data: pass this data to the action. support named parameters or indexed parameters. the first use JSON object carrier the arguments, and the last use JSON array. In additionally, if only one argument needed by the action, either entire JSON object or the first element of JSON array will be used.
- extensionName: this is the name of dependencies that you added by
-
define your own native method. method arguments is converted by Jackson ObjectMapper, so all ObjectMapper compatible type should be fine. besides, the
org.json.JSONObjectandorg.json.JSONArrayis treated as special, you can directly use them are method arguments.
- update checking
- stream message
- more activity configuration