public class CordovaInterfaceImpl extends java.lang.Object implements CordovaInterface
Modifier and Type | Field and Description |
---|---|
protected android.app.Activity |
activity |
protected CordovaPlugin |
activityResultCallback |
protected int |
activityResultRequestCode |
protected boolean |
activityWasDestroyed |
protected java.lang.String |
initCallbackService |
protected CallbackMap |
permissionResultCallbacks |
protected PluginManager |
pluginManager |
protected android.os.Bundle |
savedPluginState |
protected org.apache.cordova.CordovaInterfaceImpl.ActivityResultHolder |
savedResult |
protected java.util.concurrent.ExecutorService |
threadPool |
Constructor and Description |
---|
CordovaInterfaceImpl(android.app.Activity activity) |
CordovaInterfaceImpl(android.app.Activity activity,
java.util.concurrent.ExecutorService threadPool) |
Modifier and Type | Method and Description |
---|---|
android.app.Activity |
getActivity()
Get the Android activity.
|
java.util.concurrent.ExecutorService |
getThreadPool()
Returns a shared thread pool that can be used for background tasks.
|
boolean |
hasPermission(java.lang.String permission)
Check for a permission.
|
boolean |
onActivityResult(int requestCode,
int resultCode,
android.content.Intent intent)
Routes the result to the awaiting plugin.
|
void |
onCordovaInit(PluginManager pluginManager)
Dispatches any pending onActivityResult callbacks and sends the resume event if the
Activity was destroyed by the OS.
|
java.lang.Object |
onMessage(java.lang.String id,
java.lang.Object data)
Called when a message is sent to plugin.
|
void |
onRequestPermissionResult(int requestCode,
java.lang.String[] permissions,
int[] grantResults)
Called by the system when the user grants permissions
|
void |
onSaveInstanceState(android.os.Bundle outState)
Saves parameters for startActivityForResult().
|
void |
requestPermission(CordovaPlugin plugin,
int requestCode,
java.lang.String permission)
Sends a permission request to the activity for one permission.
|
void |
requestPermissions(CordovaPlugin plugin,
int requestCode,
java.lang.String[] permissions)
Sends a permission request to the activity for a group of permissions
|
void |
restoreInstanceState(android.os.Bundle savedInstanceState)
Call this from onCreate() so that any saved startActivityForResult parameters will be restored.
|
void |
setActivityResultCallback(CordovaPlugin plugin)
Set the plugin to be called when a sub-activity exits.
|
void |
setActivityResultRequestCode(int requestCode)
Call this from your startActivityForResult() overload.
|
void |
startActivityForResult(CordovaPlugin command,
android.content.Intent intent,
int requestCode)
Launch an activity for which you would like a result when it finished.
|
protected android.app.Activity activity
protected java.util.concurrent.ExecutorService threadPool
protected PluginManager pluginManager
protected org.apache.cordova.CordovaInterfaceImpl.ActivityResultHolder savedResult
protected CallbackMap permissionResultCallbacks
protected CordovaPlugin activityResultCallback
protected java.lang.String initCallbackService
protected int activityResultRequestCode
protected boolean activityWasDestroyed
protected android.os.Bundle savedPluginState
public CordovaInterfaceImpl(android.app.Activity activity)
public CordovaInterfaceImpl(android.app.Activity activity, java.util.concurrent.ExecutorService threadPool)
public void startActivityForResult(CordovaPlugin command, android.content.Intent intent, int requestCode)
CordovaInterface
startActivityForResult
in interface CordovaInterface
command
- The command objectintent
- The intent to startrequestCode
- The request code that is passed to callback to identify the activitypublic void setActivityResultCallback(CordovaPlugin plugin)
CordovaInterface
setActivityResultCallback
in interface CordovaInterface
plugin
- The plugin on which onActivityResult is to be calledpublic android.app.Activity getActivity()
CordovaInterface
getActivity
in interface CordovaInterface
public java.lang.Object onMessage(java.lang.String id, java.lang.Object data)
CordovaInterface
onMessage
in interface CordovaInterface
id
- The message iddata
- The message datapublic java.util.concurrent.ExecutorService getThreadPool()
CordovaInterface
getThreadPool
in interface CordovaInterface
public void onCordovaInit(PluginManager pluginManager)
public boolean onActivityResult(int requestCode, int resultCode, android.content.Intent intent)
public void setActivityResultRequestCode(int requestCode)
public void onSaveInstanceState(android.os.Bundle outState)
public void restoreInstanceState(android.os.Bundle savedInstanceState)
public void onRequestPermissionResult(int requestCode, java.lang.String[] permissions, int[] grantResults) throws org.json.JSONException
requestCode
- permissions
- grantResults
- org.json.JSONException
public void requestPermission(CordovaPlugin plugin, int requestCode, java.lang.String permission)
CordovaInterface
requestPermission
in interface CordovaInterface
public void requestPermissions(CordovaPlugin plugin, int requestCode, java.lang.String[] permissions)
CordovaInterface
requestPermissions
in interface CordovaInterface
public boolean hasPermission(java.lang.String permission)
CordovaInterface
hasPermission
in interface CordovaInterface