public class CordovaActivity
extends android.app.Activity
package org.apache.cordova.examples;
import android.os.Bundle;
import org.apache.cordova.*;
public classes Example extends CordovaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.init();
// Load your application
loadUrl(launchUrl);
}
}
Cordova xml configuration: Cordova uses a configuration file at
res/xml/config.xml to specify its settings. See "The config.xml File"
guide in cordova-docs at http://cordova.apache.org/docs for the documentation
for the configuration. The use of the set*Property() methods is
deprecated in favor of the config.xml file.| Modifier and Type | Field and Description |
|---|---|
protected CordovaWebView |
appView |
protected CordovaInterfaceImpl |
cordovaInterface |
protected boolean |
immersiveMode |
protected boolean |
keepRunning |
protected java.lang.String |
launchUrl |
protected java.util.ArrayList<PluginEntry> |
pluginEntries |
protected CordovaPreferences |
preferences |
static java.lang.String |
TAG |
DEFAULT_KEYS_DIALER, DEFAULT_KEYS_DISABLE, DEFAULT_KEYS_SEARCH_GLOBAL, DEFAULT_KEYS_SEARCH_LOCAL, DEFAULT_KEYS_SHORTCUT, FOCUSED_STATE_SET, RESULT_CANCELED, RESULT_FIRST_USER, RESULT_OKACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_EXTERNAL_SERVICE, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, FINGERPRINT_SERVICE, HARDWARE_PROPERTIES_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_NO_LOCALIZED_COLLATORS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_STATS_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, SHORTCUT_SERVICE, STORAGE_SERVICE, SYSTEM_HEALTH_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE| Constructor and Description |
|---|
CordovaActivity() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
createViews() |
void |
displayError(java.lang.String title,
java.lang.String message,
java.lang.String button,
boolean exit)
Display an error dialog and optionally exit application.
|
protected void |
init() |
protected void |
loadConfig() |
void |
loadUrl(java.lang.String url)
Load the url into the webview.
|
protected CordovaInterfaceImpl |
makeCordovaInterface() |
protected CordovaWebView |
makeWebView()
Construct the default web view object.
|
protected CordovaWebViewEngine |
makeWebViewEngine() |
protected 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 |
onConfigurationChanged(android.content.res.Configuration newConfig)
Called by the system when the device configuration changes while your activity is running.
|
void |
onCreate(android.os.Bundle savedInstanceState)
Called when the activity is first created.
|
boolean |
onCreateOptionsMenu(android.view.Menu menu) |
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.
|
protected void |
onNewIntent(android.content.Intent intent)
Called when the activity receives a new intent
|
boolean |
onOptionsItemSelected(android.view.MenuItem item) |
protected void |
onPause()
Called when the system is about to start resuming a previous activity.
|
boolean |
onPrepareOptionsMenu(android.view.Menu menu) |
void |
onReceivedError(int errorCode,
java.lang.String description,
java.lang.String failingUrl)
Report an error to the host application.
|
void |
onRequestPermissionsResult(int requestCode,
java.lang.String[] permissions,
int[] grantResults)
Called by the system when the user grants permissions
|
protected void |
onResume()
Called when the activity will start interacting with the user.
|
protected void |
onSaveInstanceState(android.os.Bundle outState) |
protected void |
onStart()
Called when the activity is becoming visible to the user.
|
protected void |
onStop()
Called when the activity is no longer visible to the user.
|
void |
onWindowFocusChanged(boolean hasFocus)
Called when view focus is changed
|
void |
startActivityForResult(android.content.Intent intent,
int requestCode,
android.os.Bundle options) |
addContentView, closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dismissKeyboardShortcutsHelper, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, dump, enterPictureInPictureMode, findViewById, finish, finishActivity, finishActivityFromChild, finishAffinity, finishAfterTransition, finishAndRemoveTask, finishFromChild, getActionBar, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getContentScene, getContentTransitionManager, getCurrentFocus, getFragmentManager, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLoaderManager, getLocalClassName, getMediaController, getMenuInflater, getParent, getParentActivityIntent, getPreferences, getReferrer, getRequestedOrientation, getSearchEvent, getSystemService, getTaskId, getTitle, getTitleColor, getVoiceInteractor, getVolumeControlStream, getWindow, getWindowManager, hasWindowFocus, invalidateOptionsMenu, isChangingConfigurations, isChild, isDestroyed, isFinishing, isImmersive, isInMultiWindowMode, isInPictureInPictureMode, isLocalVoiceInteractionSupported, isTaskRoot, isVoiceInteraction, isVoiceInteractionRoot, managedQuery, moveTaskToBack, navigateUpTo, navigateUpToFromChild, onActionModeFinished, onActionModeStarted, onActivityReenter, onApplyThemeResource, onAttachedToWindow, onAttachFragment, onBackPressed, onChildTitleChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreate, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateDialog, onCreateNavigateUpTaskStack, onCreatePanelMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onCreateView, onDetachedFromWindow, onEnterAnimationComplete, onGenericMotionEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onLocalVoiceInteractionStarted, onLocalVoiceInteractionStopped, onLowMemory, onMenuItemSelected, onMenuOpened, onMultiWindowModeChanged, onNavigateUp, onNavigateUpFromChild, onOptionsMenuClosed, onPanelClosed, onPictureInPictureModeChanged, onPostCreate, onPostCreate, onPostResume, onPrepareDialog, onPrepareDialog, onPrepareNavigateUpTaskStack, onPreparePanel, onProvideAssistContent, onProvideAssistData, onProvideKeyboardShortcuts, onProvideReferrer, onRestart, onRestoreInstanceState, onRestoreInstanceState, onRetainNonConfigurationInstance, onSaveInstanceState, onSearchRequested, onSearchRequested, onStateNotSaved, onTitleChanged, onTouchEvent, onTrackballEvent, onTrimMemory, onUserInteraction, onUserLeaveHint, onVisibleBehindCanceled, onWindowAttributesChanged, onWindowStartingActionMode, onWindowStartingActionMode, openContextMenu, openOptionsMenu, overridePendingTransition, postponeEnterTransition, recreate, registerForContextMenu, releaseInstance, removeDialog, reportFullyDrawn, requestDragAndDropPermissions, requestPermissions, requestShowKeyboardShortcuts, requestVisibleBehind, requestWindowFeature, runOnUiThread, setActionBar, setContentTransitionManager, setContentView, setContentView, setContentView, setDefaultKeyMode, setEnterSharedElementCallback, setExitSharedElementCallback, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setFinishOnTouchOutside, setImmersive, setIntent, setMediaController, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setTaskDescription, setTheme, setTitle, setTitle, setTitleColor, setVisible, setVolumeControlStream, setVrModeEnabled, shouldShowRequestPermissionRationale, shouldUpRecreateTask, showAssist, showDialog, showDialog, showLockTaskEscapeMessage, startActionMode, startActionMode, startActivities, startActivities, startActivity, startActivity, startActivityForResult, startActivityFromChild, startActivityFromChild, startActivityFromFragment, startActivityFromFragment, startActivityIfNeeded, startActivityIfNeeded, startIntentSender, startIntentSender, startIntentSenderForResult, startIntentSenderForResult, startIntentSenderFromChild, startIntentSenderFromChild, startLocalVoiceInteraction, startLockTask, startManagingCursor, startNextMatchingActivity, startNextMatchingActivity, startPostponedEnterTransition, startSearch, stopLocalVoiceInteraction, stopLockTask, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterForContextMenuapplyOverrideConfiguration, attachBaseContext, getAssets, getResources, getThemebindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, clearWallpaper, createConfigurationContext, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDataDir, getDir, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getSharedPreferences, getSystemServiceName, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, setWallpaper, startInstrumentation, startService, stopService, unbindService, unregisterReceiverpublic static java.lang.String TAG
protected CordovaWebView appView
protected boolean keepRunning
protected boolean immersiveMode
protected CordovaPreferences preferences
protected java.lang.String launchUrl
protected java.util.ArrayList<PluginEntry> pluginEntries
protected CordovaInterfaceImpl cordovaInterface
public void onCreate(android.os.Bundle savedInstanceState)
onCreate in class android.app.Activityprotected void init()
protected void loadConfig()
protected void createViews()
protected CordovaWebView makeWebView()
protected CordovaWebViewEngine makeWebViewEngine()
protected CordovaInterfaceImpl makeCordovaInterface()
public void loadUrl(java.lang.String url)
protected void onPause()
onPause in class android.app.Activityprotected void onNewIntent(android.content.Intent intent)
onNewIntent in class android.app.Activityprotected void onResume()
onResume in class android.app.Activityprotected void onStop()
onStop in class android.app.Activityprotected void onStart()
onStart in class android.app.Activitypublic void onDestroy()
onDestroy in class android.app.Activitypublic void onWindowFocusChanged(boolean hasFocus)
onWindowFocusChanged in interface android.view.Window.CallbackonWindowFocusChanged in class android.app.Activitypublic void startActivityForResult(android.content.Intent intent,
int requestCode,
android.os.Bundle options)
startActivityForResult in class android.app.Activityprotected void onActivityResult(int requestCode,
int resultCode,
android.content.Intent intent)
onActivityResult in class android.app.ActivityrequestCode - 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 onReceivedError(int errorCode,
java.lang.String description,
java.lang.String failingUrl)
errorCode - The error code corresponding to an ERROR_* value.description - A String describing the error.failingUrl - The url that failed to load.public void displayError(java.lang.String title,
java.lang.String message,
java.lang.String button,
boolean exit)
public boolean onCreateOptionsMenu(android.view.Menu menu)
onCreateOptionsMenu in class android.app.Activitypublic boolean onPrepareOptionsMenu(android.view.Menu menu)
onPrepareOptionsMenu in class android.app.Activitypublic boolean onOptionsItemSelected(android.view.MenuItem item)
onOptionsItemSelected in class android.app.Activitypublic java.lang.Object onMessage(java.lang.String id,
java.lang.Object data)
id - The message iddata - The message dataprotected void onSaveInstanceState(android.os.Bundle outState)
onSaveInstanceState in class android.app.Activitypublic void onConfigurationChanged(android.content.res.Configuration newConfig)
onConfigurationChanged in interface android.content.ComponentCallbacksonConfigurationChanged in class android.app.ActivitynewConfig - The new device configurationpublic void onRequestPermissionsResult(int requestCode,
java.lang.String[] permissions,
int[] grantResults)
onRequestPermissionsResult in class android.app.ActivityrequestCode - permissions - grantResults -