ContextWrapper
open class ContextWrapper : Context
Known Direct Subclasses
| Application |
Base class for maintaining global application state.
|
| BackupAgent |
Provides the central interface between an application and Android's data backup infrastructure.
|
| ContextThemeWrapper |
A context wrapper that allows you to modify or replace the theme of the wrapped context.
|
| IsolatedContext |
A mock context which prevents its users from talking to the rest of the device while stubbing enough methods to satify code that tries to talk to other packages.
|
| MutableContextWrapper |
Special version of ContextWrapper that allows the base context to be modified after it is initially set.
|
| RenamingDelegatingContext |
This is a class which delegates to the given context, but performs database and file operations with a renamed database/file name (prefixes default names with a given prefix).
|
| Service |
A Service is an application component representing either an application's desire to perform a longer-running operation while not interacting with the user or to supply functionality for other applications to use.
|
|
Known Indirect Subclasses
AbstractInputMethodService, AccessibilityService, AccountAuthenticatorActivity, Activity, ActivityGroup, AliasActivity, AutofillService, BackupAgentHelper, CallRedirectionService, CallScreeningService, CameraPrewarmService, CarrierMessagingClientService, and 42 others.
| AbstractInputMethodService |
AbstractInputMethodService provides a abstract base class for input methods.
|
| AccessibilityService |
Accessibility services should only be used to assist users with disabilities in using Android devices and apps.
|
| AccountAuthenticatorActivity |
Base class for implementing an Activity that is used to help implement an AbstractAccountAuthenticator.
|
| Activity |
An activity is a single, focused thing that the user can do.
|
| ActivityGroup |
A screen that contains and runs multiple embedded activities.
|
| AliasActivity |
Stub activity that launches another activity (and then finishes itself) based on information in its component's manifest meta-data.
|
| AutofillService |
An AutofillService is a service used to automatically fill the contents of the screen on behalf of a given user - for more information about autofill, read Autofill Framework.
|
| BackupAgentHelper |
A convenient BackupAgent wrapper class that automatically manages heterogeneous data sets within the backup data, each identified by a unique key prefix.
|
| CallRedirectionService |
This service can be implemented to interact between Telecom and its implementor for making outgoing call with optional redirection/cancellation purposes.
|
| CallScreeningService |
This service can be implemented by the default dialer (see TelecomManager#getDefaultDialerPackage()) or a third party app to allow or disallow incoming calls before they are shown to a user.
|
| CameraPrewarmService |
Extend this class to implement a camera prewarm service.
|
| CarrierMessagingClientService |
If the default SMS app has a service that extends this class, the system always tries to bind it so that the process is always running, which allows the app to have a persistent connection to the server.
|
| CarrierMessagingService |
A service that receives calls from the system when new SMS and MMS are sent or received.
|
| CarrierService |
A service that exposes carrier-specific functionality to the system.
|
| ChooserTargetService |
A service that receives calls from the system when the user is asked to choose a target for an intent explicitly by another app.
|
| ConditionProviderService |
A service that provides conditions about boolean state.
|
| ConnectionService |
An abstract service that should be implemented by any apps which either:
- Can make phone calls (VoIP or otherwise) and want those calls to be integrated into the built-in phone app. Referred to as a system managed
ConnectionService.
- Are a standalone calling app and don't want their calls to be integrated into the built-in phone app. Referred to as a self managed
ConnectionService.
Once implemented, the ConnectionService needs to take the following steps so that Telecom will bind to it:
|
| ControlsProviderService |
Service implementation allowing applications to contribute controls to the System UI.
|
| DeviceAdminService |
Base class for a service that device owner/profile owners can optionally have.
|
| DreamService |
Extend this class to implement a custom dream (available to the user as a "Daydream").
|
| ExpandableListActivity |
An activity that displays an expandable list of items by binding to a data source implementing the ExpandableListAdapter, and exposes event handlers when the user selects an item.
|
| HostApduService |
HostApduService is a convenience Service class that can be extended to emulate an NFC card inside an Android service component.
|
| HostNfcFService |
HostNfcFService is a convenience Service class that can be extended to emulate an NFC-F card inside an Android service component.
|
| InCallService |
This service is implemented by an app that wishes to provide functionality for managing phone calls.
|
| InputMethodService |
InputMethodService provides a standard implementation of an InputMethod, which final implementations can derive from and customize.
|
| IntentService |
IntentService is a base class for Services that handle asynchronous requests (expressed as Intents) on demand.
|
| JobService |
Entry point for the callback from the android.app.job.JobScheduler.
|
| LauncherActivity |
Displays a list of all activities which can be performed for a given intent.
|
| ListActivity |
An activity that displays a list of items by binding to a data source such as an array or Cursor, and exposes event handlers when the user selects an item.
|
| MediaBrowserService |
Base class for media browser services.
|
| MediaRoute2ProviderService |
Base class for media route provider services.
|
| MediaSession2Service |
This API is not generally intended for third party application developers.
|
| MidiDeviceService |
A service that implements a virtual MIDI device.
|
| MockApplication |
A mock android.app.Application class.
|
| NativeActivity |
Convenience for implementing an activity that will be implemented purely in native code.
|
| NotificationListenerService |
A service that receives calls from the system when new notifications are posted or removed, or their ranking changed.
|
| OffHostApduService |
OffHostApduService is a convenience Service class that can be extended to describe one or more NFC applications that are residing off-host, for example on an embedded secure element or a UICC.
|
| PreferenceActivity |
This is the base class for an activity to show a hierarchy of preferences to the user.
|
| PrintService |
This is the base class for implementing print services.
|
| QuickAccessWalletService |
A QuickAccessWalletService provides a list of WalletCards shown in the Quick Access Wallet.
|
| RecognitionService |
This class provides a base class for recognition service implementations.
|
| RemoteViewsService |
The service to be connected to for a remote adapter to request RemoteViews.
|
| SettingInjectorService |
Dynamically specifies the summary (subtitle) and enabled status of a preference injected into the list of app settings displayed by the system settings app
|
| SpellCheckerService |
SpellCheckerService provides an abstract base class for a spell checker.
|
| TabActivity |
For apps developing against android.os.Build.VERSION_CODES#HONEYCOMB or later, tabs are typically presented in the UI using the new ActionBar#newTab() and related APIs for placing tabs within their action bar area.
|
| TextToSpeechService |
Abstract base class for TTS engine implementations.
|
| TileService |
A TileService provides the user a tile that can be added to Quick Settings.
|
| TvInputService |
The TvInputService class represents a TV input or source such as HDMI or built-in tuner which provides pass-through video or broadcast TV programs.
|
| VisualVoicemailService |
This service is implemented by dialer apps that wishes to handle OMTP or similar visual voicemails.
|
| VoiceInteractionService |
Top-level service of the current global voice interactor, which is providing support for hotwording, the back-end of a android.app.VoiceInteractor, etc.
|
| VoiceInteractionSessionService |
An active voice interaction session, initiated by a VoiceInteractionService.
|
| VpnService |
VpnService is a base class for applications to extend and build their own VPN solutions.
|
| VrListenerService |
A service that is bound from the system while running in virtual reality (VR) mode.
|
| WallpaperService |
A wallpaper service is responsible for showing a live wallpaper behind applications that would like to sit on top of it.
|
|
Proxying implementation of Context that simply delegates all of its calls to another Context. Can be subclassed to modify behavior without changing the original Context.
Summary
Inherited constants
|
From class Context
String |
ACCESSIBILITY_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.view.accessibility.AccessibilityManager for giving the user feedback for UI events through the registered event listeners.
|
String |
ACCOUNT_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.accounts.AccountManager for receiving intents at a time of your choosing.
|
String |
ACTIVITY_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.app.ActivityManager for interacting with the global system state.
|
String |
ALARM_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.app.AlarmManager for receiving intents at a time of your choosing.
|
String |
APPWIDGET_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.appwidget.AppWidgetManager for accessing AppWidgets.
|
String |
APP_OPS_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.app.AppOpsManager for tracking application operations on the device.
|
String |
AUDIO_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.media.AudioManager for handling management of volume, ringer modes and audio routing.
|
String |
BATTERY_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.os.BatteryManager for managing battery state.
|
Int |
BIND_ABOVE_CLIENT
Flag for bindService: indicates that the client application binding to this service considers the service to be more important than the app itself. When set, the platform will try to have the out of memory killer kill the app before it kills the service it is bound to, though this is not guaranteed to be the case.
|
Int |
BIND_ADJUST_WITH_ACTIVITY
Flag for bindService: If binding from an activity, allow the target service's process importance to be raised based on whether the activity is visible to the user, regardless whether another flag is used to reduce the amount that the client process's overall importance is used to impact it.
|
Int |
BIND_ALLOW_OOM_MANAGEMENT
Flag for bindService: allow the process hosting the bound service to go through its normal memory management. It will be treated more like a running service, allowing the system to (temporarily) expunge the process if low on memory or for some other whim it may have, and being more aggressive about making it a candidate to be killed (and restarted) if running for a long time.
|
Int |
BIND_AUTO_CREATE
Flag for bindService: automatically create the service as long as the binding exists. Note that while this will create the service, its android.app.Service#onStartCommand method will still only be called due to an explicit call to startService. Even without that, though, this still provides you with access to the service object while the service is created.
Note that prior to android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH, not supplying this flag would also impact how important the system consider's the target service's process to be. When set, the only way for it to be raised was by binding from a service in which case it will only be important when that activity is in the foreground. Now to achieve this behavior you must explicitly supply the new flag BIND_ADJUST_WITH_ACTIVITY. For compatibility, old applications that don't specify BIND_AUTO_CREATE will automatically have the flags BIND_WAIVE_PRIORITY and BIND_ADJUST_WITH_ACTIVITY set for them in order to achieve the same result.
|
Int |
BIND_DEBUG_UNBIND
Flag for bindService: include debugging help for mismatched calls to unbind. When this flag is set, the callstack of the following unbindService call is retained, to be printed if a later incorrect unbind call is made. Note that doing this requires retaining information about the binding that was made for the lifetime of the app, resulting in a leak -- this should only be used for debugging.
|
Int |
BIND_EXTERNAL_SERVICE
Flag for bindService: The service being bound is an isolated, external service. This binds the service into the calling application's package, rather than the package in which the service is declared.
When using this flag, the code for the service being bound will execute under the calling application's package name and user ID. Because the service must be an isolated process, it will not have direct access to the application's data, though. The purpose of this flag is to allow applications to provide services that are attributed to the app using the service, rather than the application providing the service.
|
Int |
BIND_IMPORTANT
Flag for bindService: this service is very important to the client, so should be brought to the foreground process level when the client is. Normally a process can only be raised to the visibility level by a client, even if that client is in the foreground.
|
Int |
BIND_INCLUDE_CAPABILITIES
Flag for bindService: If binding from an app that has specific capabilities due to its foreground state such as an activity or foreground service, then this flag will allow the bound app to get the same capabilities, as long as it has the required permissions as well.
|
Int |
BIND_NOT_FOREGROUND
Flag for bindService: don't allow this binding to raise the target service's process to the foreground scheduling priority. It will still be raised to at least the same memory priority as the client (so that its process will not be killable in any situation where the client is not killable), but for CPU scheduling purposes it may be left in the background. This only has an impact in the situation where the binding client is a foreground process and the target service is in a background process.
|
Int |
BIND_NOT_PERCEPTIBLE
Flag for bindService: If binding from an app that is visible or user-perceptible, lower the target service's importance to below the perceptible level. This allows the system to (temporarily) expunge the bound process from memory to make room for more important user-perceptible processes.
|
Int |
BIND_WAIVE_PRIORITY
Flag for bindService: don't impact the scheduling or memory management priority of the target service's hosting process. Allows the service's process to be managed on the background LRU list just like a regular application process in the background.
|
String |
BIOMETRIC_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.hardware.biometrics.BiometricManager for handling biometric and PIN/pattern/password authentication.
|
String |
BLOB_STORE_SERVICE
Use with getSystemService(java.lang.String) to retrieve a for contributing and accessing data blobs from the blob store maintained by the system.
|
String |
BLUETOOTH_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.bluetooth.BluetoothManager for using Bluetooth.
|
String |
CAMERA_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.hardware.camera2.CameraManager for interacting with camera devices.
|
String |
CAPTIONING_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.view.accessibility.CaptioningManager for obtaining captioning properties and listening for changes in captioning preferences.
|
String |
CARRIER_CONFIG_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.telephony.CarrierConfigManager for reading carrier configuration values.
|
String |
CLIPBOARD_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.content.ClipboardManager for accessing and modifying the contents of the global clipboard.
|
String |
COMPANION_DEVICE_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.companion.CompanionDeviceManager for managing companion devices
|
String |
CONNECTIVITY_DIAGNOSTICS_SERVICE
Use with getSystemService(java.lang.String) to retrieve a for performing network connectivity diagnostics as well as receiving network connectivity information from the system.
|
String |
CONNECTIVITY_SERVICE
Use with getSystemService(java.lang.String) to retrieve a for handling management of network connections.
|
String |
CONSUMER_IR_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.hardware.ConsumerIrManager for transmitting infrared signals from the device.
|
Int |
CONTEXT_IGNORE_SECURITY
Flag for use with createPackageContext: ignore any security restrictions on the Context being requested, allowing it to always be loaded. For use with CONTEXT_INCLUDE_CODE to allow code to be loaded into a process even when it isn't safe to do so. Use with extreme care!
|
Int |
CONTEXT_INCLUDE_CODE
Flag for use with createPackageContext: include the application code with the context. This means loading code into the caller's process, so that getClassLoader() can be used to instantiate the application's classes. Setting this flags imposes security restrictions on what application context you can access; if the requested application can not be safely loaded into your process, java.lang.SecurityException will be thrown. If this flag is not set, there will be no restrictions on the packages that can be loaded, but getClassLoader will always return the default system class loader.
|
Int |
CONTEXT_RESTRICTED
Flag for use with createPackageContext: a restricted context may disable specific features. For instance, a View associated with a restricted context would ignore particular XML attributes.
|
String |
CROSS_PROFILE_APPS_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.content.pm.CrossProfileApps for cross profile operations.
|
String |
DEVICE_POLICY_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.app.admin.DevicePolicyManager for working with global device policy management.
|
String |
DISPLAY_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.hardware.display.DisplayManager for interacting with display devices.
|
String |
DOWNLOAD_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.app.DownloadManager for requesting HTTP downloads.
|
String |
DROPBOX_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.os.DropBoxManager instance for recording diagnostic logs.
|
String |
EUICC_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.telephony.euicc.EuiccManager to manage the device eUICC (embedded SIM).
|
String |
FILE_INTEGRITY_SERVICE
Use with getSystemService(java.lang.String) to retrieve an android.security.FileIntegrityManager.
|
String |
FINGERPRINT_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.hardware.fingerprint.FingerprintManager for handling management of fingerprints.
|
String |
HARDWARE_PROPERTIES_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.os.HardwarePropertiesManager for accessing the hardware properties service.
|
String |
INPUT_METHOD_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.view.inputmethod.InputMethodManager for accessing input methods.
|
String |
INPUT_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.hardware.input.InputManager for interacting with input devices.
|
String |
IPSEC_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.net.IpSecManager for encrypting Sockets or Networks with IPSec.
|
String |
JOB_SCHEDULER_SERVICE
Use with getSystemService(java.lang.String) to retrieve a instance for managing occasional background tasks.
|
String |
KEYGUARD_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.app.KeyguardManager for controlling keyguard.
|
String |
LAUNCHER_APPS_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.content.pm.LauncherApps for querying and monitoring launchable apps across profiles of a user.
|
String |
LAYOUT_INFLATER_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.view.LayoutInflater for inflating layout resources in this context.
|
String |
LOCATION_SERVICE
Use with getSystemService(java.lang.String) to retrieve a for controlling location updates.
|
String |
MEDIA_PROJECTION_SERVICE
Use with getSystemService(java.lang.String) to retrieve a instance for managing media projection sessions.
|
String |
MEDIA_ROUTER_SERVICE
Use with getSystemService to retrieve a android.media.MediaRouter for controlling and managing routing of media.
|
String |
MEDIA_SESSION_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.media.session.MediaSessionManager for managing media Sessions.
|
String |
MIDI_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.media.midi.MidiManager for accessing the MIDI service.
|
Int |
MODE_APPEND
File creation mode: for use with openFileOutput, if the file already exists then write data to the end of the existing file instead of erasing it.
|
Int |
MODE_ENABLE_WRITE_AHEAD_LOGGING
Database open flag: when set, the database is opened with write-ahead logging enabled by default.
|
Int |
MODE_MULTI_PROCESS
SharedPreference loading flag: when set, the file on disk will be checked for modification even if the shared preferences instance is already loaded in this process. This behavior is sometimes desired in cases where the application has multiple processes, all writing to the same SharedPreferences file. Generally there are better forms of communication between processes, though.
This was the legacy (but undocumented) behavior in and before Gingerbread (Android 2.3) and this flag is implied when targeting such releases. For applications targeting SDK versions greater than Android 2.3, this flag must be explicitly set if desired.
|
Int |
MODE_NO_LOCALIZED_COLLATORS
Database open flag: when set, the database is opened without support for localized collators.
|
Int |
MODE_PRIVATE
File creation mode: the default mode, where the created file can only be accessed by the calling application (or all applications sharing the same user ID).
|
Int |
MODE_WORLD_READABLE
File creation mode: allow all other applications to have read access to the created file.
Starting from android.os.Build.VERSION_CODES#N, attempting to use this mode throws a SecurityException.
|
Int |
MODE_WORLD_WRITEABLE
File creation mode: allow all other applications to have write access to the created file.
Starting from android.os.Build.VERSION_CODES#N, attempting to use this mode will throw a SecurityException.
|
String |
NETWORK_STATS_SERVICE
Use with getSystemService(java.lang.String) to retrieve a for querying network usage stats.
|
String |
NFC_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.nfc.NfcManager for using NFC.
|
String |
NOTIFICATION_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.app.NotificationManager for informing the user of background events.
|
String |
NSD_SERVICE
Use with getSystemService(java.lang.String) to retrieve a for handling management of network service discovery
|
String |
POWER_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.os.PowerManager for controlling power management, including "wake locks," which let you keep the device on while you're running long tasks.
|
String |
PRINT_SERVICE
android.print.PrintManager for printing and managing printers and print tasks.
|
Int |
RECEIVER_VISIBLE_TO_INSTANT_APPS
Flag for registerReceiver: The receiver can receive broadcasts from Instant Apps.
|
String |
RESTRICTIONS_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.content.RestrictionsManager for retrieving application restrictions and requesting permissions for restricted operations.
|
String |
ROLE_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.app.role.RoleManager for managing roles.
|
String |
SEARCH_SERVICE
Use with getSystemService(java.lang.String) to retrieve a for handling searches.
Configuration#UI_MODE_TYPE_WATCH does not support android.app.SearchManager.
|
String |
SENSOR_SERVICE
Use with getSystemService(java.lang.String) to retrieve a for accessing sensors.
|
String |
SHORTCUT_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.content.pm.ShortcutManager for accessing the launcher shortcut service.
|
String |
STORAGE_SERVICE
Use with getSystemService(java.lang.String) to retrieve a for accessing system storage functions.
|
String |
STORAGE_STATS_SERVICE
Use with getSystemService(java.lang.String) to retrieve a for accessing system storage statistics.
|
String |
SYSTEM_HEALTH_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.os.health.SystemHealthManager for accessing system health (battery, power, memory, etc) metrics.
|
String |
TELECOM_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.telecom.TelecomManager to manage telecom-related features of the device.
|
String |
TELEPHONY_IMS_SERVICE
Use with getSystemService(java.lang.String) to retrieve an android.telephony.ims.ImsManager.
|
String |
TELEPHONY_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.telephony.TelephonyManager for handling management the telephony features of the device.
|
String |
TELEPHONY_SUBSCRIPTION_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.telephony.SubscriptionManager for handling management the telephony subscriptions of the device.
|
String |
TEXT_CLASSIFICATION_SERVICE
Use with getSystemService(java.lang.String) to retrieve a TextClassificationManager for text classification services.
|
String |
TEXT_SERVICES_MANAGER_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.view.textservice.TextServicesManager for accessing text services.
|
String |
TV_INPUT_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.media.tv.TvInputManager for interacting with TV inputs on the device.
|
String |
UI_MODE_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.app.UiModeManager for controlling UI modes.
|
String |
USAGE_STATS_SERVICE
Use with getSystemService(java.lang.String) to retrieve a for querying device usage stats.
|
String |
USB_SERVICE
Use with getSystemService(java.lang.String) to retrieve a for access to USB devices (as a USB host) and for controlling this device's behavior as a USB device.
|
String |
USER_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.os.UserManager for managing users on devices that support multiple users.
|
String |
VIBRATOR_SERVICE
Use with getSystemService(java.lang.String) to retrieve a for interacting with the vibration hardware.
|
String |
VPN_MANAGEMENT_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.net.VpnManager to manage profiles for the platform built-in VPN.
|
String |
WALLPAPER_SERVICE
Use with getSystemService(java.lang.String) to retrieve a com.android.server.WallpaperService for accessing wallpapers.
|
String |
WIFI_AWARE_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.net.wifi.aware.WifiAwareManager for handling management of Wi-Fi Aware.
|
String |
WIFI_P2P_SERVICE
Use with getSystemService(java.lang.String) to retrieve a for handling management of Wi-Fi peer-to-peer connections.
|
String |
WIFI_RTT_RANGING_SERVICE
Use with getSystemService(java.lang.String) to retrieve a for ranging devices with wifi.
|
String |
WIFI_SERVICE
Use with getSystemService(java.lang.String) to retrieve a for handling management of Wi-Fi access.
|
String |
WINDOW_SERVICE
Use with getSystemService(java.lang.String) to retrieve a android.view.WindowManager for accessing the system's window manager.
|
|
Protected methods
|
| open Unit |
Set the base context for this ContextWrapper.
|
Inherited functions
|
From class Context
Int |
getColor(id: Int)
Returns a color associated with a particular resource ID and styled for the current theme.
|
ColorStateList |
getColorStateList(id: Int)
Returns a color state list associated with a particular resource ID and styled for the current theme.
|
Drawable? |
getDrawable(id: Int)
Returns a drawable object associated with a particular resource ID and styled for the current theme.
|
String |
getString(resId: Int)
Returns a localized string from the application's package's default string table.
|
String |
getString(resId: Int, vararg formatArgs: Any!)
Returns a localized formatted string from the application's package's default string table, substituting the format arguments as defined in java.util.Formatter and java.lang.String#format.
|
T |
getSystemService(serviceClass: Class<T>)
Return the handle to a system-level service by class.
Currently available classes are: android.view.WindowManager, android.view.LayoutInflater, android.app.ActivityManager, android.os.PowerManager, android.app.AlarmManager, android.app.NotificationManager, android.app.KeyguardManager, android.location.LocationManager, android.app.SearchManager, android.os.Vibrator, android.net.ConnectivityManager, android.net.wifi.WifiManager, android.media.AudioManager, android.media.MediaRouter, android.telephony.TelephonyManager, android.telephony.SubscriptionManager, android.view.inputmethod.InputMethodManager, android.app.UiModeManager, android.app.DownloadManager, android.os.BatteryManager, android.app.job.JobScheduler, android.app.usage.NetworkStatsManager.
Note: System services obtained via this API may be closely associated with the Context in which they are obtained from. In general, do not share the service objects between various different contexts (Activities, Applications, Services, Providers, etc.)
Note: Instant apps, for which PackageManager#isInstantApp() returns true, don't have access to the following system services: DEVICE_POLICY_SERVICE, FINGERPRINT_SERVICE, KEYGUARD_SERVICE, SHORTCUT_SERVICE, USB_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WIFI_AWARE_SERVICE. For these services this method will return null. Generally, if you are running as an instant app you should always check whether the result of this method is null.
|
CharSequence |
getText(resId: Int)
Return a localized, styled CharSequence from the application's package's default string table.
|
TypedArray |
obtainStyledAttributes(attrs: IntArray)
Retrieve styled attribute information in this Context's theme. See android.content.res.Resources.Theme#obtainStyledAttributes(int[]) for more information.
|
TypedArray |
obtainStyledAttributes(resid: Int, attrs: IntArray)
Retrieve styled attribute information in this Context's theme. See android.content.res.Resources.Theme#obtainStyledAttributes(int, int[]) for more information.
|
TypedArray |
obtainStyledAttributes(set: AttributeSet?, attrs: IntArray)
Retrieve styled attribute information in this Context's theme. See android.content.res.Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int) for more information.
|
TypedArray |
obtainStyledAttributes(set: AttributeSet?, attrs: IntArray, defStyleAttr: Int, defStyleRes: Int)
Retrieve styled attribute information in this Context's theme. See android.content.res.Resources.Theme#obtainStyledAttributes(AttributeSet, int[], int, int) for more information.
|
Unit |
registerComponentCallbacks(callback: ComponentCallbacks!)
Add a new ComponentCallbacks to the base application of the Context, which will be called at the same times as the ComponentCallbacks methods of activities and other components are called. Note that you must be sure to use unregisterComponentCallbacks when appropriate in the future; this will not be removed for you.
|
Unit |
sendBroadcastWithMultiplePermissions(intent: Intent, receiverPermissions: Array<String!>)
Broadcast the given intent to all interested BroadcastReceivers, allowing an array of required permissions to be enforced. This call is asynchronous; it returns immediately, and you will continue executing while the receivers are run. No results are propagated from receivers and receivers can not abort the broadcast. If you want to allow receivers to propagate results or abort the broadcast, you must send an ordered broadcast using sendOrderedBroadcast(android.content.Intent,java.lang.String).
See BroadcastReceiver for more information on Intent broadcasts.
|
Unit |
unregisterComponentCallbacks(callback: ComponentCallbacks!)
Remove a ComponentCallbacks object that was previously registered with registerComponentCallbacks(android.content.ComponentCallbacks).
|
|
Public constructors
<init>
ContextWrapper(base: Context!)
Public methods
bindIsolatedService
open fun bindIsolatedService(
service: Intent,
flags: Int,
instanceName: String,
executor: Executor,
conn: ServiceConnection
): Boolean
| Parameters |
service |
Intent: Identifies the service to connect to. The Intent must specify an explicit component name. This value cannot be null. |
flags |
Int: Operation options for the binding as per bindService. Value is either 0 or a combination of android.content.Context#BIND_AUTO_CREATE, android.content.Context#BIND_DEBUG_UNBIND, android.content.Context#BIND_NOT_FOREGROUND, android.content.Context#BIND_ABOVE_CLIENT, android.content.Context#BIND_ALLOW_OOM_MANAGEMENT, android.content.Context#BIND_WAIVE_PRIORITY, android.content.Context#BIND_IMPORTANT, android.content.Context#BIND_ADJUST_WITH_ACTIVITY, android.content.Context#BIND_NOT_PERCEPTIBLE, and android.content.Context#BIND_INCLUDE_CAPABILITIES |
instanceName |
String: Unique identifier for the service instance. Each unique name here will result in a different service instance being created. Identifiers must only contain ASCII letters, digits, underscores, and periods. This value cannot be null. |
executor |
Executor: Callbacks on ServiceConnection will be called on executor. Must use same instance for the same instance of ServiceConnection. This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). To dispatch events through a shared thread pool, you can use AsyncTask#THREAD_POOL_EXECUTOR. |
conn |
ServiceConnection: Receives information as the service is started and stopped. This must be a valid ServiceConnection object; it must not be null. This value cannot be null. |
| Exceptions |
java.lang.SecurityException |
If the caller does not have permission to access the service |
java.lang.IllegalArgumentException |
If the instanceName is invalid. |
bindService
open fun bindService(
service: Intent!,
conn: ServiceConnection,
flags: Int
): Boolean
| Parameters |
service |
Intent!: Identifies the service to connect to. The Intent must specify an explicit component name. |
conn |
ServiceConnection: Receives information as the service is started and stopped. This must be a valid ServiceConnection object; it must not be null. This value cannot be null. |
flags |
Int: Operation options for the binding. May be 0, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_NOT_FOREGROUND, BIND_ABOVE_CLIENT, BIND_ALLOW_OOM_MANAGEMENT, BIND_WAIVE_PRIORITY. BIND_IMPORTANT, or BIND_ADJUST_WITH_ACTIVITY. Value is either 0 or a combination of android.content.Context#BIND_AUTO_CREATE, android.content.Context#BIND_DEBUG_UNBIND, android.content.Context#BIND_NOT_FOREGROUND, android.content.Context#BIND_ABOVE_CLIENT, android.content.Context#BIND_ALLOW_OOM_MANAGEMENT, android.content.Context#BIND_WAIVE_PRIORITY, android.content.Context#BIND_IMPORTANT, android.content.Context#BIND_ADJUST_WITH_ACTIVITY, android.content.Context#BIND_NOT_PERCEPTIBLE, and android.content.Context#BIND_INCLUDE_CAPABILITIES |
| Return |
Boolean |
true if the system is in the process of bringing up a service that your client has permission to bind to; false if the system couldn't find the service or if your client doesn't have permission to bind to it. If this value is true, you should later call unbindService to release the connection. |
| Exceptions |
java.lang.SecurityException |
If the caller does not have permission to access the service or the service can not be found. |
bindService
open fun bindService(
service: Intent,
flags: Int,
executor: Executor,
conn: ServiceConnection
): Boolean
| Parameters |
executor |
Executor: Callbacks on ServiceConnection will be called on executor. Must use same instance for the same instance of ServiceConnection. This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). To dispatch events through a shared thread pool, you can use AsyncTask#THREAD_POOL_EXECUTOR. |
service |
Intent: This value cannot be null. |
flags |
Int: Value is either 0 or a combination of android.content.Context#BIND_AUTO_CREATE, android.content.Context#BIND_DEBUG_UNBIND, android.content.Context#BIND_NOT_FOREGROUND, android.content.Context#BIND_ABOVE_CLIENT, android.content.Context#BIND_ALLOW_OOM_MANAGEMENT, android.content.Context#BIND_WAIVE_PRIORITY, android.content.Context#BIND_IMPORTANT, android.content.Context#BIND_ADJUST_WITH_ACTIVITY, android.content.Context#BIND_NOT_PERCEPTIBLE, and android.content.Context#BIND_INCLUDE_CAPABILITIES |
conn |
ServiceConnection: This value cannot be null. |
checkCallingOrSelfPermission
open fun checkCallingOrSelfPermission(permission: String): Int
| Parameters |
permission |
String: The name of the permission being checked. This value cannot be null. |
checkCallingOrSelfUriPermission
open fun checkCallingOrSelfUriPermission(
uri: Uri!,
modeFlags: Int
): Int
checkCallingPermission
open fun checkCallingPermission(permission: String): Int
| Parameters |
permission |
String: The name of the permission being checked. This value cannot be null. |
checkCallingUriPermission
open fun checkCallingUriPermission(
uri: Uri!,
modeFlags: Int
): Int
checkPermission
open fun checkPermission(
permission: String,
pid: Int,
uid: Int
): Int
| Parameters |
permission |
String: The name of the permission being checked. This value cannot be null. |
pid |
Int: The process ID being checked against. Must be > 0. |
uid |
Int: The user ID being checked against. A uid of 0 is the root user, which will pass every permission check. |
checkSelfPermission
open fun checkSelfPermission(permission: String): Int
| Parameters |
permission |
String: The name of the permission being checked. This value cannot be null. |
checkUriPermission
open fun checkUriPermission(
uri: Uri!,
pid: Int,
uid: Int,
modeFlags: Int
): Int
checkUriPermission
open fun checkUriPermission(
uri: Uri?,
readPermission: String?,
writePermission: String?,
pid: Int,
uid: Int,
modeFlags: Int
): Int
| Parameters |
uri |
Uri?: The Uri whose permission is to be checked, or null to not do this check. This value may be null. |
readPermission |
String?: The permission that provides overall read access, or null to not do this check. This value may be null. |
writePermission |
String?: The permission that provides overall write access, or null to not do this check. This value may be null. |
pid |
Int: The process ID being checked against. Must be > 0. |
uid |
Int: The user ID being checked against. A uid of 0 is the root user, which will pass every permission check. |
modeFlags |
Int: The access modes to check. Value is either 0 or a combination of android.content.Intent#FLAG_GRANT_READ_URI_PERMISSION, and android.content.Intent#FLAG_GRANT_WRITE_URI_PERMISSION |
clearWallpaper
open fun clearWallpaper(): Unit
Deprecated.
createAttributionContext
open fun createAttributionContext(attributionTag: String?): Context
Return a new Context object for the current Context but attribute to a different tag. In complex apps attribution tagging can be used to distinguish between separate logical parts.
| Parameters |
attributionTag |
String?: This value may be null. |
| Return |
Context |
This value cannot be null. |
createConfigurationContext
open fun createConfigurationContext(overrideConfiguration: Configuration): Context!
| Parameters |
overrideConfiguration |
Configuration: A Configuration specifying what values to modify in the base Configuration of the original Context's resources. If the base configuration changes (such as due to an orientation change), the resources of this context will also change except for those that have been explicitly overridden with a value here. This value cannot be null. |
createDeviceProtectedStorageContext
open fun createDeviceProtectedStorageContext(): Context!
createDisplayContext
open fun createDisplayContext(display: Display): Context!
| Parameters |
display |
Display: A Display object specifying the display for whose metrics the Context's resources should be tailored. This value cannot be null. |
createPackageContext
open fun createPackageContext(
packageName: String!,
flags: Int
): Context!
| Exceptions |
java.lang.SecurityException |
|
android.content.pm.PackageManager.NameNotFoundException |
if there is no application with the given package name. |
createWindowContext
open fun createWindowContext(
type: Int,
options: Bundle?
): Context
Creates a Context for a non-activity window.
A window context is a context that can be used to add non-activity windows, such as android.view.WindowManager.LayoutParams#TYPE_APPLICATION_OVERLAY. A window context must be created from a context that has an associated Display, such as Activity or a context created with createDisplayContext(android.view.Display).
The window context is created with the appropriate Configuration for the area of the display that the windows created with it can occupy; it must be used when inflating views, such that they can be inflated with proper Resources. Below is a sample code to add an application overlay window on the primary display:
...
final DisplayManager dm = anyContext.getSystemService(DisplayManager.class);
final Display primaryDisplay = dm.getDisplay(DEFAULT_DISPLAY);
final Context windowContext = anyContext.createDisplayContext(primaryDisplay)
.createWindowContext(TYPE_APPLICATION_OVERLAY, null);
final View overlayView = Inflater.from(windowContext).inflate(someLayoutXml, null);
// WindowManager.LayoutParams initialization
...
mParams.type = TYPE_APPLICATION_OVERLAY;
...
mWindowContext.getSystemService(WindowManager.class).addView(overlayView, mParams);
This context's configuration and resources are adjusted to a display area where the windows with provided type will be added. Note that all windows associated with the same context will have an affinity and can only be moved together between different displays or areas on a display. If there is a need to add different window types, or non-associated windows, separate Contexts should be used.
Creating a window context is an expensive operation. Misuse of this API may lead to a huge performance drop. The best practice is to use the same window context when possible. An approach is to create one window context with specific window type and display and use it everywhere it's needed..
| Parameters |
type |
Int: Value is android.view.WindowManager.LayoutParams#TYPE_ACCESSIBILITY_OVERLAY, android.view.WindowManager.LayoutParams#TYPE_APPLICATION, android.view.WindowManager.LayoutParams#TYPE_APPLICATION_ATTACHED_DIALOG, android.view.WindowManager.LayoutParams#TYPE_APPLICATION_MEDIA, android.view.WindowManager.LayoutParams#TYPE_APPLICATION_OVERLAY, android.view.WindowManager.LayoutParams#TYPE_APPLICATION_PANEL, android.view.WindowManager.LayoutParams#TYPE_APPLICATION_STARTING, android.view.WindowManager.LayoutParams#TYPE_APPLICATION_SUB_PANEL, android.view.WindowManager.LayoutParams#TYPE_BASE_APPLICATION, android.view.WindowManager.LayoutParams#TYPE_DRAWN_APPLICATION, android.view.WindowManager.LayoutParams#TYPE_INPUT_METHOD, android.view.WindowManager.LayoutParams#TYPE_INPUT_METHOD_DIALOG, android.view.WindowManager.LayoutParams.TYPE_KEYGUARD, android.view.WindowManager.LayoutParams#TYPE_KEYGUARD_DIALOG, android.view.WindowManager.LayoutParams#TYPE_PHONE, android.view.WindowManager.LayoutParams#TYPE_PRIORITY_PHONE, android.view.WindowManager.LayoutParams#TYPE_PRIVATE_PRESENTATION, android.view.WindowManager.LayoutParams#TYPE_SEARCH_BAR, android.view.WindowManager.LayoutParams#TYPE_STATUS_BAR, android.view.WindowManager.LayoutParams#TYPE_STATUS_BAR_PANEL, android.view.WindowManager.LayoutParams#TYPE_SYSTEM_ALERT, android.view.WindowManager.LayoutParams#TYPE_SYSTEM_DIALOG, android.view.WindowManager.LayoutParams#TYPE_SYSTEM_ERROR, android.view.WindowManager.LayoutParams#TYPE_SYSTEM_OVERLAY, android.view.WindowManager.LayoutParams#TYPE_TOAST, or android.view.WindowManager.LayoutParams#TYPE_WALLPAPER |
options |
Bundle?: This value may be null. |
| Return |
Context |
This value cannot be null. |
| Exceptions |
java.lang.UnsupportedOperationException |
if this Context does not attach to a display or the current number of window contexts without adding any view by WindowManager#addView exceeds five. |
databaseList
open fun databaseList(): Array<String!>!
| Return |
Array<String!>! |
Array of strings naming the private databases. |
deleteDatabase
open fun deleteDatabase(name: String!): Boolean
| Parameters |
name |
String!: The name (unique in the application package) of the database. |
| Return |
Boolean |
true if the database was successfully deleted; else false. |
deleteFile
open fun deleteFile(name: String!): Boolean
| Parameters |
name |
String!: The name of the file to delete; can not contain path separators. |
| Return |
Boolean |
true if the file was successfully deleted; else false. |
deleteSharedPreferences
open fun deleteSharedPreferences(name: String!): Boolean
| Parameters |
name |
String!: The name (unique in the application package) of the shared preferences file. |
| Return |
Boolean |
true if the shared preferences file was successfully deleted; else false. |
enforceCallingOrSelfPermission
open fun enforceCallingOrSelfPermission(
permission: String,
message: String?
): Unit
| Parameters |
permission |
String: The name of the permission being checked. This value cannot be null. |
message |
String?: A message to include in the exception if it is thrown. This value may be null. |
enforceCallingOrSelfUriPermission
open fun enforceCallingOrSelfUriPermission(
uri: Uri!,
modeFlags: Int,
message: String!
): Unit
enforceCallingPermission
open fun enforceCallingPermission(
permission: String,
message: String?
): Unit
| Parameters |
permission |
String: The name of the permission being checked. This value cannot be null. |
message |
String?: A message to include in the exception if it is thrown. This value may be null. |
enforceCallingUriPermission
open fun enforceCallingUriPermission(
uri: Uri!,
modeFlags: Int,
message: String!
): Unit
enforcePermission
open fun enforcePermission(
permission: String,
pid: Int,
uid: Int,
message: String?
): Unit
| Parameters |
permission |
String: The name of the permission being checked. This value cannot be null. |
pid |
Int: The process ID being checked against. Must be > 0. |
uid |
Int: The user ID being checked against. A uid of 0 is the root user, which will pass every permission check. |
message |
String?: A message to include in the exception if it is thrown. This value may be null. |
enforceUriPermission
open fun enforceUriPermission(
uri: Uri!,
pid: Int,
uid: Int,
modeFlags: Int,
message: String!
): Unit
enforceUriPermission
open fun enforceUriPermission(
uri: Uri?,
readPermission: String?,
writePermission: String?,
pid: Int,
uid: Int,
modeFlags: Int,
message: String?
): Unit
| Parameters |
uri |
Uri?: The Uri whose permission is to be checked, or null to not do this check. This value may be null. |
readPermission |
String?: The permission that provides overall read access, or null to not do this check. This value may be null. |
writePermission |
String?: The permission that provides overall write access, or null to not do this check. This value may be null. |
pid |
Int: The process ID being checked against. Must be > 0. |
uid |
Int: The user ID being checked against. A uid of 0 is the root user, which will pass every permission check. |
modeFlags |
Int: The access modes to enforce. Value is either 0 or a combination of android.content.Intent#FLAG_GRANT_READ_URI_PERMISSION, and android.content.Intent#FLAG_GRANT_WRITE_URI_PERMISSION |
message |
String?: A message to include in the exception if it is thrown. This value may be null. |
fileList
open fun fileList(): Array<String!>!
| Return |
Array<String!>! |
Array of strings naming the private files. |
getApplicationContext
open fun getApplicationContext(): Context!
getAssets
open fun getAssets(): AssetManager!
| Return |
AssetManager! |
an AssetManager instance for the application's package |
getBaseContext
open fun getBaseContext(): Context!
| Return |
Context! |
the base context as set by the constructor or setBaseContext |
getCacheDir
open fun getCacheDir(): File!
| Return |
File! |
The path of the directory holding application cache files. |
getCodeCacheDir
open fun getCodeCacheDir(): File!
| Return |
File! |
The path of the directory holding application code cache files. |
getDataDir
open fun getDataDir(): File!
getDatabasePath
open fun getDatabasePath(name: String!): File!
| Parameters |
name |
String!: The name of the database for which you would like to get its path. |
| Return |
File! |
An absolute path to the given database. |
getDir
open fun getDir(
name: String!,
mode: Int
): File!
| Return |
File! |
A File object for the requested directory. The directory will have been created if it does not already exist. |
getExternalCacheDir
open fun getExternalCacheDir(): File?
| Return |
File? |
the absolute path to application-specific directory. May return null if shared storage is not currently available. |
getExternalCacheDirs
open fun getExternalCacheDirs(): Array<File!>!
| Return |
Array<File!>! |
the absolute paths to application-specific directories. Some individual paths may be null if that shared storage is not currently available. The first path returned is the same as getExternalCacheDir(). |
getExternalFilesDir
open fun getExternalFilesDir(type: String?): File?
| Return |
File? |
the absolute path to application-specific directory. May return null if shared storage is not currently available. |
getExternalFilesDirs
open fun getExternalFilesDirs(type: String!): Array<File!>!
| Return |
Array<File!>! |
the absolute paths to application-specific directories. Some individual paths may be null if that shared storage is not currently available. The first path returned is the same as getExternalFilesDir(java.lang.String). |
getExternalMediaDirs
open fun getExternalMediaDirs(): Array<File!>!
| Return |
Array<File!>! |
the absolute paths to application-specific directories. Some individual paths may be null if that shared storage is not currently available. |
getFileStreamPath
open fun getFileStreamPath(name: String!): File!
| Parameters |
name |
String!: The name of the file for which you would like to get its path. |
| Return |
File! |
An absolute path to the given file. |
getFilesDir
open fun getFilesDir(): File!
| Return |
File! |
The path of the directory holding application files. |
getMainExecutor
open fun getMainExecutor(): Executor!
getMainLooper
open fun getMainLooper(): Looper!
| Return |
Looper! |
The main looper. |
getNoBackupFilesDir
open fun getNoBackupFilesDir(): File!
| Return |
File! |
The path of the directory holding application files that will not be automatically backed up to remote storage. |
getObbDir
open fun getObbDir(): File!
| Return |
File! |
the absolute path to application-specific directory. May return null if shared storage is not currently available. |
getObbDirs
open fun getObbDirs(): Array<File!>!
| Return |
Array<File!>! |
the absolute paths to application-specific directories. Some individual paths may be null if that shared storage is not currently available. The first path returned is the same as getObbDir() |
getPackageCodePath
open fun getPackageCodePath(): String!
| Return |
String! |
String Path to the code and assets. |
getPackageName
open fun getPackageName(): String!
getPackageResourcePath
open fun getPackageResourcePath(): String!
| Return |
String! |
String Path to the resources. |
getResources
open fun getResources(): Resources!
| Return |
Resources! |
a Resources instance for the application's package |
getSystemService
open fun getSystemService(name: String): Any!
| Parameters |
name |
String: The name of the desired service. Value is android.content.Context#POWER_SERVICE, android.content.Context#WINDOW_SERVICE, android.content.Context#LAYOUT_INFLATER_SERVICE, android.content.Context#ACCOUNT_SERVICE, android.content.Context#ACTIVITY_SERVICE, android.content.Context#ALARM_SERVICE, android.content.Context#NOTIFICATION_SERVICE, android.content.Context#ACCESSIBILITY_SERVICE, android.content.Context#CAPTIONING_SERVICE, android.content.Context#KEYGUARD_SERVICE, android.content.Context#LOCATION_SERVICE, android.content.Context#SEARCH_SERVICE, android.content.Context#SENSOR_SERVICE, android.content.Context.SENSOR_PRIVACY_SERVICE, android.content.Context#STORAGE_SERVICE, android.content.Context#STORAGE_STATS_SERVICE, android.content.Context#WALLPAPER_SERVICE, android.content.Context.TIME_ZONE_RULES_MANAGER_SERVICE, android.content.Context#VIBRATOR_SERVICE, android.content.Context#CONNECTIVITY_SERVICE, android.content.Context#IPSEC_SERVICE, android.content.Context#VPN_MANAGEMENT_SERVICE, android.content.Context.TEST_NETWORK_SERVICE, android.content.Context#NETWORK_STATS_SERVICE, android.content.Context#WIFI_SERVICE, android.content.Context#WIFI_AWARE_SERVICE, android.content.Context#WIFI_P2P_SERVICE, android.content.Context.WIFI_SCANNING_SERVICE, android.content.Context#WIFI_RTT_RANGING_SERVICE, android.content.Context#NSD_SERVICE, android.content.Context#AUDIO_SERVICE, android.content.Context.AUTH_SERVICE, android.content.Context#FINGERPRINT_SERVICE, android.content.Context#BIOMETRIC_SERVICE, android.content.Context#MEDIA_ROUTER_SERVICE, android.content.Context#TELEPHONY_SERVICE, android.content.Context#TELEPHONY_SUBSCRIPTION_SERVICE, android.content.Context#CARRIER_CONFIG_SERVICE, android.content.Context#EUICC_SERVICE, android.content.Context#TELECOM_SERVICE, android.content.Context#CLIPBOARD_SERVICE, android.content.Context#INPUT_METHOD_SERVICE, android.content.Context#TEXT_SERVICES_MANAGER_SERVICE, android.content.Context#TEXT_CLASSIFICATION_SERVICE, android.content.Context#APPWIDGET_SERVICE, android.content.Context.ROLLBACK_SERVICE, android.content.Context#DROPBOX_SERVICE, android.content.Context#DEVICE_POLICY_SERVICE, android.content.Context#UI_MODE_SERVICE, android.content.Context#DOWNLOAD_SERVICE, android.content.Context#NFC_SERVICE, android.content.Context#BLUETOOTH_SERVICE, android.content.Context#USB_SERVICE, android.content.Context#LAUNCHER_APPS_SERVICE, android.content.Context#INPUT_SERVICE, android.content.Context#DISPLAY_SERVICE, android.content.Context#USER_SERVICE, android.content.Context#RESTRICTIONS_SERVICE, android.content.Context#APP_OPS_SERVICE, android.content.Context#ROLE_SERVICE, android.content.Context#CAMERA_SERVICE, android.content.Context#PRINT_SERVICE, android.content.Context#CONSUMER_IR_SERVICE, android.content.Context#TV_INPUT_SERVICE, android.content.Context#USAGE_STATS_SERVICE, android.content.Context#MEDIA_SESSION_SERVICE, android.content.Context#BATTERY_SERVICE, android.content.Context#JOB_SCHEDULER_SERVICE, android.content.Context#MEDIA_PROJECTION_SERVICE, android.content.Context#MIDI_SERVICE, android.content.Context.RADIO_SERVICE, android.content.Context#HARDWARE_PROPERTIES_SERVICE, android.content.Context#SHORTCUT_SERVICE, android.content.Context#SYSTEM_HEALTH_SERVICE, android.content.Context#COMPANION_DEVICE_SERVICE, android.content.Context#CROSS_PROFILE_APPS_SERVICE, android.content.Context.PERMISSION_SERVICE, or android.content.Context.LIGHTS_SERVICE This value cannot be null. |
| Return |
Any! |
The service or null if the name does not exist. |
getSystemServiceName
open fun getSystemServiceName(serviceClass: Class<*>): String?
| Parameters |
serviceClass |
Class<*>: The class of the desired service. This value cannot be null. |
| Return |
String? |
The service name or null if the class is not a supported system service. |
getWallpaper
open fun getWallpaper(): Drawable!
Deprecated.
getWallpaperDesiredMinimumHeight
open fun getWallpaperDesiredMinimumHeight(): Int
Deprecated.
getWallpaperDesiredMinimumWidth
open fun getWallpaperDesiredMinimumWidth(): Int
Deprecated.
grantUriPermission
open fun grantUriPermission(
toPackage: String!,
uri: Uri!,
modeFlags: Int
): Unit
isDeviceProtectedStorage
open fun isDeviceProtectedStorage(): Boolean
isRestricted
open fun isRestricted(): Boolean
| Return |
Boolean |
true if this Context is restricted, false otherwise. |
moveDatabaseFrom
open fun moveDatabaseFrom(
sourceContext: Context!,
name: String!
): Boolean
| Parameters |
sourceContext |
Context!: The source context which contains the existing database to move. |
name |
String!: The name of the database file. |
| Return |
Boolean |
true if the move was successful or if the database didn't exist in the source context, otherwise false. |
moveSharedPreferencesFrom
open fun moveSharedPreferencesFrom(
sourceContext: Context!,
name: String!
): Boolean
| Parameters |
sourceContext |
Context!: The source context which contains the existing shared preferences to move. |
name |
String!: The name of the shared preferences file. |
| Return |
Boolean |
true if the move was successful or if the shared preferences didn't exist in the source context, otherwise false. |
open fun openFileInput(name: String!): FileInputStream!
| Parameters |
name |
String!: The name of the file to open; can not contain path separators. |
peekWallpaper
open fun peekWallpaper(): Drawable!
Deprecated.
registerReceiver
open fun registerReceiver(
receiver: BroadcastReceiver?,
filter: IntentFilter!
): Intent?
| Parameters |
receiver |
BroadcastReceiver?: The BroadcastReceiver to handle the broadcast. This value may be null. |
filter |
IntentFilter!: Selects the Intent broadcasts to be received. |
| Return |
Intent? |
The first sticky intent found that matches filter, or null if there are none. |
registerReceiver
open fun registerReceiver(
receiver: BroadcastReceiver!,
filter: IntentFilter!,
broadcastPermission: String?,
scheduler: Handler?
): Intent?
| Parameters |
receiver |
BroadcastReceiver!: The BroadcastReceiver to handle the broadcast. |
filter |
IntentFilter!: Selects the Intent broadcasts to be received. |
broadcastPermission |
String?: String naming a permissions that a broadcaster must hold in order to send an Intent to you. If null, no permission is required. This value may be null. |
scheduler |
Handler?: Handler identifying the thread that will receive the Intent. If null, the main thread of the process will be used. This value may be null. |
| Return |
Intent? |
The first sticky intent found that matches filter, or null if there are none. |
removeStickyBroadcast
open fun removeStickyBroadcast(intent: Intent!): Unit
Deprecated.
| Parameters |
intent |
Intent!: The Intent that was previously broadcast. |
removeStickyBroadcastAsUser
open fun removeStickyBroadcastAsUser(
intent: Intent!,
user: UserHandle!
): Unit
Deprecated.
| Parameters |
intent |
Intent!: The Intent that was previously broadcast. |
user |
UserHandle!: UserHandle to remove the sticky broadcast from. |
revokeUriPermission
open fun revokeUriPermission(
uri: Uri!,
modeFlags: Int
): Unit
revokeUriPermission
open fun revokeUriPermission(
targetPackage: String!,
uri: Uri!,
modeFlags: Int
): Unit
sendBroadcast
open fun sendBroadcast(intent: Intent!): Unit
| Parameters |
intent |
Intent!: The Intent to broadcast; all receivers matching this Intent will receive the broadcast. |
sendBroadcast
open fun sendBroadcast(
intent: Intent!,
receiverPermission: String?
): Unit
| Parameters |
intent |
Intent!: The Intent to broadcast; all receivers matching this Intent will receive the broadcast. |
receiverPermission |
String?: (optional) String naming a permission that a receiver must hold in order to receive your broadcast. If null, no permission is required. This value may be null. |
sendBroadcastAsUser
open fun sendBroadcastAsUser(
intent: Intent!,
user: UserHandle!
): Unit
| Parameters |
intent |
Intent!: The intent to broadcast |
user |
UserHandle!: UserHandle to send the intent to. |
sendBroadcastAsUser
open fun sendBroadcastAsUser(
intent: Intent!,
user: UserHandle!,
receiverPermission: String?
): Unit
| Parameters |
intent |
Intent!: The Intent to broadcast; all receivers matching this Intent will receive the broadcast. |
user |
UserHandle!: UserHandle to send the intent to. |
receiverPermission |
String?: (optional) String naming a permission that a receiver must hold in order to receive your broadcast. If null, no permission is required. This value may be null. |
sendOrderedBroadcast
open fun sendOrderedBroadcast(
intent: Intent!,
receiverPermission: String?
): Unit
| Parameters |
intent |
Intent!: The Intent to broadcast; all receivers matching this Intent will receive the broadcast. |
receiverPermission |
String?: (optional) String naming a permissions that a receiver must hold in order to receive your broadcast. If null, no permission is required. This value may be null. |
sendOrderedBroadcast
open fun sendOrderedBroadcast(
intent: Intent,
receiverPermission: String?,
resultReceiver: BroadcastReceiver?,
scheduler: Handler?,
initialCode: Int,
initialData: String?,
initialExtras: Bundle?
): Unit
| Parameters |
intent |
Intent: The Intent to broadcast; all receivers matching this Intent will receive the broadcast. This value cannot be null. |
receiverPermission |
String?: String naming a permissions that a receiver must hold in order to receive your broadcast. If null, no permission is required. This value may be null. |
resultReceiver |
BroadcastReceiver?: Your own BroadcastReceiver to treat as the final receiver of the broadcast. This value may be null. |
scheduler |
Handler?: A custom Handler with which to schedule the resultReceiver callback; if null it will be scheduled in the Context's main thread. This value may be null. |
initialCode |
Int: An initial value for the result code. Often Activity.RESULT_OK. |
initialData |
String?: An initial value for the result data. Often null. This value may be null. |
initialExtras |
Bundle?: An initial value for the result extras. Often null. This value may be null. |
sendOrderedBroadcast
open fun sendOrderedBroadcast(
intent: Intent,
receiverPermission: String?,
receiverAppOp: String?,
resultReceiver: BroadcastReceiver?,
scheduler: Handler?,
initialCode: Int,
initialData: String?,
initialExtras: Bundle?
): Unit
Version of sendOrderedBroadcast(android.content.Intent,java.lang.String,android.content.BroadcastReceiver,android.os.Handler,int,java.lang.String,android.os.Bundle) that allows you to specify the App Op to enforce restrictions on which receivers the broadcast will be sent to.
See BroadcastReceiver for more information on Intent broadcasts.
| Parameters |
intent |
Intent: This value cannot be null. |
receiverPermission |
String?: This value may be null. |
receiverAppOp |
String?: This value may be null. |
resultReceiver |
BroadcastReceiver?: This value may be null. |
scheduler |
Handler?: This value may be null. |
initialCode |
Int: An initial value for the result code. Often Activity.RESULT_OK. |
initialData |
String?: This value may be null. |
initialExtras |
Bundle?: This value may be null. |
sendOrderedBroadcast
open fun sendOrderedBroadcast(
intent: Intent,
initialCode: Int,
receiverPermission: String?,
receiverAppOp: String?,
resultReceiver: BroadcastReceiver?,
scheduler: Handler?,
initialData: String?,
initialExtras: Bundle?,
options: Bundle?
): Unit
| Parameters |
intent |
Intent: This value cannot be null. |
receiverPermission |
String?: This value may be null. |
receiverAppOp |
String?: This value may be null. |
resultReceiver |
BroadcastReceiver?: This value may be null. |
scheduler |
Handler?: This value may be null. |
initialData |
String?: This value may be null. |
initialExtras |
Bundle?: This value may be null. |
options |
Bundle?: This value may be null. |
sendOrderedBroadcastAsUser
open fun sendOrderedBroadcastAsUser(
intent: Intent!,
user: UserHandle!,
receiverPermission: String?,
resultReceiver: BroadcastReceiver!,
scheduler: Handler?,
initialCode: Int,
initialData: String?,
initialExtras: Bundle?
): Unit
| Parameters |
intent |
Intent!: The Intent to broadcast; all receivers matching this Intent will receive the broadcast. |
user |
UserHandle!: UserHandle to send the intent to. |
receiverPermission |
String?: String naming a permissions that a receiver must hold in order to receive your broadcast. If null, no permission is required. This value may be null. |
resultReceiver |
BroadcastReceiver!: Your own BroadcastReceiver to treat as the final receiver of the broadcast. |
scheduler |
Handler?: A custom Handler with which to schedule the resultReceiver callback; if null it will be scheduled in the Context's main thread. This value may be null. |
initialCode |
Int: An initial value for the result code. Often Activity.RESULT_OK. |
initialData |
String?: An initial value for the result data. Often null. This value may be null. |
initialExtras |
Bundle?: An initial value for the result extras. Often null. This value may be null. |
sendStickyBroadcast
open fun sendStickyBroadcast(intent: Intent!): Unit
Deprecated.
| Parameters |
intent |
Intent!: The Intent to broadcast; all receivers matching this Intent will receive the broadcast, and the Intent will be held to be re-broadcast to future receivers. |
sendStickyBroadcastAsUser
open fun sendStickyBroadcastAsUser(
intent: Intent!,
user: UserHandle!
): Unit
Deprecated.
| Parameters |
intent |
Intent!: The Intent to broadcast; all receivers matching this Intent will receive the broadcast, and the Intent will be held to be re-broadcast to future receivers. |
user |
UserHandle!: UserHandle to send the intent to. |
sendStickyOrderedBroadcast
open fun sendStickyOrderedBroadcast(
intent: Intent!,
resultReceiver: BroadcastReceiver!,
scheduler: Handler?,
initialCode: Int,
initialData: String?,
initialExtras: Bundle?
): Unit
Deprecated.
| Parameters |
intent |
Intent!: The Intent to broadcast; all receivers matching this Intent will receive the broadcast. |
resultReceiver |
BroadcastReceiver!: Your own BroadcastReceiver to treat as the final receiver of the broadcast. |
scheduler |
Handler?: A custom Handler with which to schedule the resultReceiver callback; if null it will be scheduled in the Context's main thread. This value may be null. |
initialCode |
Int: An initial value for the result code. Often Activity.RESULT_OK. |
initialData |
String?: An initial value for the result data. Often null. This value may be null. |
initialExtras |
Bundle?: An initial value for the result extras. Often null. This value may be null. |
sendStickyOrderedBroadcastAsUser
open fun sendStickyOrderedBroadcastAsUser(
intent: Intent!,
user: UserHandle!,
resultReceiver: BroadcastReceiver!,
scheduler: Handler?,
initialCode: Int,
initialData: String?,
initialExtras: Bundle?
): Unit
Deprecated.
| Parameters |
intent |
Intent!: The Intent to broadcast; all receivers matching this Intent will receive the broadcast. |
user |
UserHandle!: UserHandle to send the intent to. |
resultReceiver |
BroadcastReceiver!: Your own BroadcastReceiver to treat as the final receiver of the broadcast. |
scheduler |
Handler?: A custom Handler with which to schedule the resultReceiver callback; if null it will be scheduled in the Context's main thread. This value may be null. |
initialCode |
Int: An initial value for the result code. Often Activity.RESULT_OK. |
initialData |
String?: An initial value for the result data. Often null. This value may be null. |
initialExtras |
Bundle?: An initial value for the result extras. Often null. This value may be null. |
setTheme
open fun setTheme(resid: Int): Unit
| Parameters |
resid |
Int: The style resource describing the theme. |
setWallpaper
open fun setWallpaper(bitmap: Bitmap!): Unit
Deprecated.
startActivities
open fun startActivities(intents: Array<Intent!>!): Unit
| Parameters |
intents |
Array<Intent!>!: An array of Intents to be started. |
| Exceptions |
android.content.ActivityNotFoundException |
|
startActivities
open fun startActivities(
intents: Array<Intent!>!,
options: Bundle!
): Unit
| Exceptions |
android.content.ActivityNotFoundException |
|
startActivity
open fun startActivity(intent: Intent!): Unit
| Parameters |
intent |
Intent!: The description of the activity to start. |
| Exceptions |
android.content.ActivityNotFoundException |
` |
startActivity
open fun startActivity(
intent: Intent!,
options: Bundle?
): Unit
| Parameters |
intent |
Intent!: The description of the activity to start. |
options |
Bundle?: Additional options for how the Activity should be started. May be null if there are no options. See android.app.ActivityOptions for how to build the Bundle supplied here; there are no supported definitions for building it manually. This value may be null. |
| Exceptions |
android.content.ActivityNotFoundException |
|
startForegroundService
open fun startForegroundService(service: Intent!): ComponentName?
| Parameters |
service |
Intent!: Identifies the service to be started. The Intent must be fully explicit (supplying a component name). Additional values may be included in the Intent extras to supply arguments along with this specific start call. |
| Return |
ComponentName? |
If the service is being started or is already running, the ComponentName of the actual service that was started is returned; else if the service does not exist null is returned. |
| Exceptions |
java.lang.SecurityException |
If the caller does not have permission to access the service or the service can not be found. |
startInstrumentation
open fun startInstrumentation(
className: ComponentName,
profileFile: String?,
arguments: Bundle?
): Boolean
| Parameters |
className |
ComponentName: Name of the Instrumentation component to be run. This value cannot be null. |
profileFile |
String?: Optional path to write profiling data as the instrumentation runs, or null for no profiling. This value may be null. |
arguments |
Bundle?: Additional optional arguments to pass to the instrumentation, or null. This value may be null. |
| Return |
Boolean |
true if the instrumentation was successfully started, else false if it could not be found. |
startIntentSender
open fun startIntentSender(
intent: IntentSender!,
fillInIntent: Intent?,
flagsMask: Int,
flagsValues: Int,
extraFlags: Int
): Unit
| Parameters |
intent |
IntentSender!: The IntentSender to launch. |
fillInIntent |
Intent?: If non-null, this will be provided as the intent parameter to IntentSender#sendIntent. This value may be null. |
flagsMask |
Int: Intent flags in the original IntentSender that you would like to change. Value is either 0 or a combination of android.content.Intent#FLAG_FROM_BACKGROUND, android.content.Intent#FLAG_DEBUG_LOG_RESOLUTION, android.content.Intent#FLAG_EXCLUDE_STOPPED_PACKAGES, android.content.Intent#FLAG_INCLUDE_STOPPED_PACKAGES, android.content.Intent.FLAG_DEBUG_TRIAGED_MISSING, android.content.Intent.FLAG_IGNORE_EPHEMERAL, android.content.Intent#FLAG_ACTIVITY_MATCH_EXTERNAL, android.content.Intent#FLAG_ACTIVITY_NO_HISTORY, android.content.Intent#FLAG_ACTIVITY_SINGLE_TOP, android.content.Intent#FLAG_ACTIVITY_NEW_TASK, android.content.Intent#FLAG_ACTIVITY_MULTIPLE_TASK, android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP, android.content.Intent#FLAG_ACTIVITY_FORWARD_RESULT, android.content.Intent#FLAG_ACTIVITY_PREVIOUS_IS_TOP, android.content.Intent#FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS, android.content.Intent#FLAG_ACTIVITY_BROUGHT_TO_FRONT, android.content.Intent#FLAG_ACTIVITY_RESET_TASK_IF_NEEDED, android.content.Intent#FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY, android.content.Intent#FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, android.content.Intent#FLAG_ACTIVITY_NEW_DOCUMENT, android.content.Intent#FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, android.content.Intent#FLAG_ACTIVITY_NO_USER_ACTION, android.content.Intent#FLAG_ACTIVITY_REORDER_TO_FRONT, android.content.Intent#FLAG_ACTIVITY_NO_ANIMATION, android.content.Intent#FLAG_ACTIVITY_CLEAR_TASK, android.content.Intent#FLAG_ACTIVITY_TASK_ON_HOME, android.content.Intent#FLAG_ACTIVITY_RETAIN_IN_RECENTS, android.content.Intent#FLAG_ACTIVITY_LAUNCH_ADJACENT, android.content.Intent#FLAG_RECEIVER_REGISTERED_ONLY, android.content.Intent#FLAG_RECEIVER_REPLACE_PENDING, android.content.Intent#FLAG_RECEIVER_FOREGROUND, android.content.Intent#FLAG_RECEIVER_NO_ABORT, android.content.Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT, android.content.Intent.FLAG_RECEIVER_BOOT_UPGRADE, android.content.Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND, android.content.Intent.FLAG_RECEIVER_EXCLUDE_BACKGROUND, android.content.Intent.FLAG_RECEIVER_FROM_SHELL, android.content.Intent#FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS, and android.content.Intent.FLAG_RECEIVER_OFFLOAD |
flagsValues |
Int: Desired values for any bits set in flagsMask Value is either 0 or a combination of android.content.Intent#FLAG_FROM_BACKGROUND, android.content.Intent#FLAG_DEBUG_LOG_RESOLUTION, android.content.Intent#FLAG_EXCLUDE_STOPPED_PACKAGES, android.content.Intent#FLAG_INCLUDE_STOPPED_PACKAGES, android.content.Intent.FLAG_DEBUG_TRIAGED_MISSING, android.content.Intent.FLAG_IGNORE_EPHEMERAL, android.content.Intent#FLAG_ACTIVITY_MATCH_EXTERNAL, android.content.Intent#FLAG_ACTIVITY_NO_HISTORY, android.content.Intent#FLAG_ACTIVITY_SINGLE_TOP, android.content.Intent#FLAG_ACTIVITY_NEW_TASK, android.content.Intent#FLAG_ACTIVITY_MULTIPLE_TASK, android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP, android.content.Intent#FLAG_ACTIVITY_FORWARD_RESULT, android.content.Intent#FLAG_ACTIVITY_PREVIOUS_IS_TOP, android.content.Intent#FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS, android.content.Intent#FLAG_ACTIVITY_BROUGHT_TO_FRONT, android.content.Intent#FLAG_ACTIVITY_RESET_TASK_IF_NEEDED, android.content.Intent#FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY, android.content.Intent#FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, android.content.Intent#FLAG_ACTIVITY_NEW_DOCUMENT, android.content.Intent#FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, android.content.Intent#FLAG_ACTIVITY_NO_USER_ACTION, android.content.Intent#FLAG_ACTIVITY_REORDER_TO_FRONT, android.content.Intent#FLAG_ACTIVITY_NO_ANIMATION, android.content.Intent#FLAG_ACTIVITY_CLEAR_TASK, android.content.Intent#FLAG_ACTIVITY_TASK_ON_HOME, android.content.Intent#FLAG_ACTIVITY_RETAIN_IN_RECENTS, android.content.Intent#FLAG_ACTIVITY_LAUNCH_ADJACENT, android.content.Intent#FLAG_RECEIVER_REGISTERED_ONLY, android.content.Intent#FLAG_RECEIVER_REPLACE_PENDING, android.content.Intent#FLAG_RECEIVER_FOREGROUND, android.content.Intent#FLAG_RECEIVER_NO_ABORT, android.content.Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT, android.content.Intent.FLAG_RECEIVER_BOOT_UPGRADE, android.content.Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND, android.content.Intent.FLAG_RECEIVER_EXCLUDE_BACKGROUND, android.content.Intent.FLAG_RECEIVER_FROM_SHELL, android.content.Intent#FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS, and android.content.Intent.FLAG_RECEIVER_OFFLOAD |
extraFlags |
Int: Always set to 0. |
startIntentSender
open fun startIntentSender(
intent: IntentSender!,
fillInIntent: Intent?,
flagsMask: Int,
flagsValues: Int,
extraFlags: Int,
options: Bundle?
): Unit
| Parameters |
intent |
IntentSender!: The IntentSender to launch. |
fillInIntent |
Intent?: If non-null, this will be provided as the intent parameter to IntentSender#sendIntent. This value may be null. |
flagsMask |
Int: Intent flags in the original IntentSender that you would like to change. Value is either 0 or a combination of android.content.Intent#FLAG_FROM_BACKGROUND, android.content.Intent#FLAG_DEBUG_LOG_RESOLUTION, android.content.Intent#FLAG_EXCLUDE_STOPPED_PACKAGES, android.content.Intent#FLAG_INCLUDE_STOPPED_PACKAGES, android.content.Intent.FLAG_DEBUG_TRIAGED_MISSING, android.content.Intent.FLAG_IGNORE_EPHEMERAL, android.content.Intent#FLAG_ACTIVITY_MATCH_EXTERNAL, android.content.Intent#FLAG_ACTIVITY_NO_HISTORY, android.content.Intent#FLAG_ACTIVITY_SINGLE_TOP, android.content.Intent#FLAG_ACTIVITY_NEW_TASK, android.content.Intent#FLAG_ACTIVITY_MULTIPLE_TASK, android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP, android.content.Intent#FLAG_ACTIVITY_FORWARD_RESULT, android.content.Intent#FLAG_ACTIVITY_PREVIOUS_IS_TOP, android.content.Intent#FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS, android.content.Intent#FLAG_ACTIVITY_BROUGHT_TO_FRONT, android.content.Intent#FLAG_ACTIVITY_RESET_TASK_IF_NEEDED, android.content.Intent#FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY, android.content.Intent#FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, android.content.Intent#FLAG_ACTIVITY_NEW_DOCUMENT, android.content.Intent#FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, android.content.Intent#FLAG_ACTIVITY_NO_USER_ACTION, android.content.Intent#FLAG_ACTIVITY_REORDER_TO_FRONT, android.content.Intent#FLAG_ACTIVITY_NO_ANIMATION, android.content.Intent#FLAG_ACTIVITY_CLEAR_TASK, android.content.Intent#FLAG_ACTIVITY_TASK_ON_HOME, android.content.Intent#FLAG_ACTIVITY_RETAIN_IN_RECENTS, android.content.Intent#FLAG_ACTIVITY_LAUNCH_ADJACENT, android.content.Intent#FLAG_RECEIVER_REGISTERED_ONLY, android.content.Intent#FLAG_RECEIVER_REPLACE_PENDING, android.content.Intent#FLAG_RECEIVER_FOREGROUND, android.content.Intent#FLAG_RECEIVER_NO_ABORT, android.content.Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT, android.content.Intent.FLAG_RECEIVER_BOOT_UPGRADE, android.content.Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND, android.content.Intent.FLAG_RECEIVER_EXCLUDE_BACKGROUND, android.content.Intent.FLAG_RECEIVER_FROM_SHELL, android.content.Intent#FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS, and android.content.Intent.FLAG_RECEIVER_OFFLOAD |
flagsValues |
Int: Desired values for any bits set in flagsMask Value is either 0 or a combination of android.content.Intent#FLAG_FROM_BACKGROUND, android.content.Intent#FLAG_DEBUG_LOG_RESOLUTION, android.content.Intent#FLAG_EXCLUDE_STOPPED_PACKAGES, android.content.Intent#FLAG_INCLUDE_STOPPED_PACKAGES, android.content.Intent.FLAG_DEBUG_TRIAGED_MISSING, android.content.Intent.FLAG_IGNORE_EPHEMERAL, android.content.Intent#FLAG_ACTIVITY_MATCH_EXTERNAL, android.content.Intent#FLAG_ACTIVITY_NO_HISTORY, android.content.Intent#FLAG_ACTIVITY_SINGLE_TOP, android.content.Intent#FLAG_ACTIVITY_NEW_TASK, android.content.Intent#FLAG_ACTIVITY_MULTIPLE_TASK, android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP, android.content.Intent#FLAG_ACTIVITY_FORWARD_RESULT, android.content.Intent#FLAG_ACTIVITY_PREVIOUS_IS_TOP, android.content.Intent#FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS, android.content.Intent#FLAG_ACTIVITY_BROUGHT_TO_FRONT, android.content.Intent#FLAG_ACTIVITY_RESET_TASK_IF_NEEDED, android.content.Intent#FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY, android.content.Intent#FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, android.content.Intent#FLAG_ACTIVITY_NEW_DOCUMENT, android.content.Intent#FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, android.content.Intent#FLAG_ACTIVITY_NO_USER_ACTION, android.content.Intent#FLAG_ACTIVITY_REORDER_TO_FRONT, android.content.Intent#FLAG_ACTIVITY_NO_ANIMATION, android.content.Intent#FLAG_ACTIVITY_CLEAR_TASK, android.content.Intent#FLAG_ACTIVITY_TASK_ON_HOME, android.content.Intent#FLAG_ACTIVITY_RETAIN_IN_RECENTS, android.content.Intent#FLAG_ACTIVITY_LAUNCH_ADJACENT, android.content.Intent#FLAG_RECEIVER_REGISTERED_ONLY, android.content.Intent#FLAG_RECEIVER_REPLACE_PENDING, android.content.Intent#FLAG_RECEIVER_FOREGROUND, android.content.Intent#FLAG_RECEIVER_NO_ABORT, android.content.Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT, android.content.Intent.FLAG_RECEIVER_BOOT_UPGRADE, android.content.Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND, android.content.Intent.FLAG_RECEIVER_EXCLUDE_BACKGROUND, android.content.Intent.FLAG_RECEIVER_FROM_SHELL, android.content.Intent#FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS, and android.content.Intent.FLAG_RECEIVER_OFFLOAD |
extraFlags |
Int: Always set to 0. |
options |
Bundle?: Additional options for how the Activity should be started. See android.content.Context#startActivity(Intent, Bundle) Context.startActivity(Intent, Bundle)} for more details. If options have also been supplied by the IntentSender, options given here will override any that conflict with those given by the IntentSender. This value may be null. |
startService
open fun startService(service: Intent!): ComponentName?
| Parameters |
service |
Intent!: Identifies the service to be started. The Intent must be fully explicit (supplying a component name). Additional values may be included in the Intent extras to supply arguments along with this specific start call. |
| Return |
ComponentName? |
If the service is being started or is already running, the ComponentName of the actual service that was started is returned; else if the service does not exist null is returned. |
| Exceptions |
java.lang.SecurityException |
If the caller does not have permission to access the service or the service can not be found. |
java.lang.IllegalStateException |
If the application is in a state where the service can not be started (such as not in the foreground in a state when services are allowed). |
stopService
open fun stopService(name: Intent!): Boolean
| Parameters |
service |
Description of the service to be stopped. The Intent must be either fully explicit (supplying a component name) or specify a specific package name it is targeted to. |
| Return |
Boolean |
If there is a service matching the given Intent that is already running, then it is stopped and true is returned; else false is returned. |
| Exceptions |
java.lang.SecurityException |
If the caller does not have permission to access the service or the service can not be found. |
java.lang.IllegalStateException |
If the application is in a state where the service can not be started (such as not in the foreground in a state when services are allowed). |
unbindService
open fun unbindService(conn: ServiceConnection): Unit
| Parameters |
conn |
ServiceConnection: The connection interface previously supplied to bindService(). This parameter must not be null. This value cannot be null. |
updateServiceGroup
open fun updateServiceGroup(
conn: ServiceConnection,
group: Int,
importance: Int
): Unit
| Parameters |
conn |
ServiceConnection: The connection interface previously supplied to bindService(). This parameter must not be null. This value cannot be null. |
group |
Int: A group to put this connection's process in. Upon calling here, this will override any previous group that was set for that process. The group tells the system about processes that are logically grouped together, so should be managed as one unit of importance (such as when being considered a recently used app). All processes in the same app with the same group are considered to be related. Supplying 0 reverts to the default behavior of not grouping. |
importance |
Int: Additional importance of the processes within a group. Upon calling here, this will override any previous importance that was set for that process. The most important process is 0, and higher values are successively less important. You can view this as describing how to order the processes in an array, with the processes at the end of the array being the least important. This value has no meaning besides indicating how processes should be ordered in that array one after the other. This provides a way to fine-tune the system's process killing, guiding it to kill processes at the end of the array first. |
Protected methods
attachBaseContext
protected open fun attachBaseContext(base: Context!): Unit
Set the base context for this ContextWrapper. All calls will then be delegated to the base context. Throws IllegalStateException if a base context has already been set.
| Parameters |
base |
Context!: The new base context for this wrapper. |