public class CommonPlugin
extends org.apache.cordova.CordovaPlugin
Modifier and Type | Field and Description |
---|---|
protected java.util.HashMap<java.lang.String,java.lang.Class<? extends CordovaAction>> |
actions |
protected static LogListener |
logListener |
Constructor and Description |
---|
CommonPlugin() |
CommonPlugin(java.lang.String childLogTag) |
Modifier and Type | Method and Description |
---|---|
boolean |
execute(java.lang.String action,
org.json.JSONArray args,
org.apache.cordova.CallbackContext callbackContext)
Executes the request.
|
void |
onActivityResult(int requestCode,
int resultCode,
android.content.Intent intent)
Called when an activity you launched exits, giving you the requestCode
you started it with, the resultCode it returned, and any additional data
from it.
|
void |
onDestroy()
The final call you receive before your activity is destroyed.
|
java.lang.Object |
onMessage(java.lang.String id,
java.lang.Object data)
Called when a message is sent to plugin.
|
void |
onNewIntent(android.content.Intent intent)
Called when the activity receives a new intent.
|
void |
onPause(boolean multitasking)
Called when the system is about to start resuming a previous activity.
|
void |
onReset()
Called when the WebView does a top-level navigation or refreshes.
|
void |
onRestoreStateForActivityResult(android.os.Bundle state,
org.apache.cordova.CallbackContext callbackContext)
Called when a plugin is the recipient of an Activity result after the
CordovaActivity has been destroyed.
|
void |
onResume(boolean multitasking)
Called when the activity will start interacting with the user.
|
android.os.Bundle |
onSaveInstanceState()
Called when the Activity is being destroyed (e.g. if a plugin calls out
to an external Activity and the OS kills the CordovaActivity in the
background).
|
void |
onStart()
Called when the activity is becoming visible to the user.
|
void |
onStop()
Called when the activity is no longer visible to the user.
|
void |
pluginInitialize()
Called after plugin construction and fields have been initialized.
|
execute, execute, fromPluginUri, getServiceName, handleOpenForRead, hasPermisssion, initialize, onConfigurationChanged, onOverrideUrlLoading, onReceivedClientCertRequest, onReceivedHttpAuthRequest, onRequestPermissionResult, privateInitialize, remapUri, requestPermissions, shouldAllowBridgeAccess, shouldAllowNavigation, shouldAllowRequest, shouldOpenExternalUrl, toPluginUri
protected static LogListener logListener
protected java.util.HashMap<java.lang.String,java.lang.Class<? extends CordovaAction>> actions
public CommonPlugin()
public CommonPlugin(java.lang.String childLogTag)
public void pluginInitialize()
pluginInitialize
in class org.apache.cordova.CordovaPlugin
public void onPause(boolean multitasking)
onPause
in class org.apache.cordova.CordovaPlugin
multitasking
- Flag indicating if multitasking is turned on for apppublic void onResume(boolean multitasking)
onResume
in class org.apache.cordova.CordovaPlugin
multitasking
- Flag indicating if multitasking is turned on for apppublic void onStart()
onStart
in class org.apache.cordova.CordovaPlugin
public void onStop()
onStop
in class org.apache.cordova.CordovaPlugin
public void onNewIntent(android.content.Intent intent)
onNewIntent
in class org.apache.cordova.CordovaPlugin
public void onDestroy()
onDestroy
in class org.apache.cordova.CordovaPlugin
public android.os.Bundle onSaveInstanceState()
onSaveInstanceState
in class org.apache.cordova.CordovaPlugin
public void onRestoreStateForActivityResult(android.os.Bundle state, org.apache.cordova.CallbackContext callbackContext)
onRestoreStateForActivityResult
in class org.apache.cordova.CordovaPlugin
state
- Bundle containing the state of the plugincallbackContext
- Replacement Context to return the plugin result topublic java.lang.Object onMessage(java.lang.String id, java.lang.Object data)
onMessage
in class org.apache.cordova.CordovaPlugin
id
- The message iddata
- The message datapublic void onActivityResult(int requestCode, int resultCode, android.content.Intent intent)
onActivityResult
in class org.apache.cordova.CordovaPlugin
requestCode
- The request code originally supplied to
startActivityForResult(), allowing you to identify who this
result came from.resultCode
- The integer result code returned by the child activity through
its setResult().intent
- An Intent, which can return result data to the caller (various
data can be attached to Intent "extras").public void onReset()
Plugins should stop any long-running processes and clean up internal state.
Does nothing by default.
onReset
in class org.apache.cordova.CordovaPlugin
public boolean execute(java.lang.String action, org.json.JSONArray args, org.apache.cordova.CallbackContext callbackContext) throws org.json.JSONException
This method is called from the WebView thread. To do a non-trivial amount of work, use: cordova.getThreadPool().execute(runnable);
To run on the UI thread, use: cordova.getActivity().runOnUiThread(runnable);
execute
in class org.apache.cordova.CordovaPlugin
action
- The action to execute.args
- The exec() arguments.callbackContext
- The callback context used when calling back into JavaScript.org.json.JSONException