public abstract class XWalkExternalExtensionManager
extends java.lang.Object
XWalkExternalExtensionManager represents an external extension manager. Its instance would be created While constructing XWalkView. XWalkView embedders could get the manager by calling XWalkView.getExtensionManager(), and then employ the manager to load their own external extensions by path, although XWalkView embedders must package their external extensions into the apk beforehand.
What would XWalkView embedders do:
1, package extension MyExtension.js/json files into apk folder assets/xwalk-extensions/MyExtension.
2, package MyExtension.jar into apk.
3, add permissions required by MyExtension into AndroidManifest.xml.
4, call XWalkView.getExtensionManager().loadExtension("xwalk-extensions/MyExtension") to load.
In embedded mode, developers can call XWalkView.getExtensionManager() to load extensions
directly after the creation of XWalkView. But in shared mode and lite mode, the Crosswalk runtime
isn't loaded yet at the moment the activity is created, so can't load extensions immediately.
To make your code compatible with all modes, please refer to the examples in XWalkActivity or
XWalkInitializer to make sure to load extensions after XWalk runtime ready.
| Constructor and Description |
|---|
XWalkExternalExtensionManager(XWalkView view)
Constructs a new XWalkExternalExtensionManager for the XWalkView.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Object |
getBridge() |
android.app.Activity |
getViewActivity()
Get current Activity for XWalkView.
|
android.content.Context |
getViewContext()
Get current Context for XWalkView.
|
void |
loadExtension(java.lang.String extensionPath)
Load one single external extension by its path.
|
abstract void |
onActivityResult(int requestCode,
int resultCode,
android.content.Intent data)
Notify onActivityResult().
|
abstract void |
onDestroy()
Notify onDestroy().
|
abstract void |
onNewIntent(android.content.Intent intent)
Notify onNewIntent().
|
abstract void |
onPause()
Notify onPause().
|
abstract void |
onResume()
Notify onResume().
|
abstract void |
onStart()
Notify onStart().
|
abstract void |
onStop()
Notify onStop().
|
public XWalkExternalExtensionManager(XWalkView view)
view - the current XWalkView object.protected java.lang.Object getBridge()
public android.app.Activity getViewActivity()
public android.content.Context getViewContext()
public void loadExtension(java.lang.String extensionPath)
extensionPath - the extension folder containing extension js/json files.public abstract void onStart()
public abstract void onResume()
public abstract void onPause()
public abstract void onStop()
public abstract void onDestroy()
public abstract void onNewIntent(android.content.Intent intent)
intent - the Intent received.public abstract void onActivityResult(int requestCode,
int resultCode,
android.content.Intent data)
requestCode - the request code.resultCode - the result code.data - the Intent data received.