0% found this document useful (0 votes)
7 views122 pages

Geofencing API_IntentService - Android Developers_en

The IntentService class in Android, which was added in API level 3 and deprecated in API level 30, is designed to handle asynchronous requests on demand using a worker thread. It processes each Intent sequentially and stops itself when there are no more requests, making it useful for offloading tasks from the main thread. Developers are encouraged to use WorkManager as an alternative due to background execution limits introduced in Android 8.0 (API level 26).

Uploaded by

Patito Feo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views122 pages

Geofencing API_IntentService - Android Developers_en

The IntentService class in Android, which was added in API level 3 and deprecated in API level 30, is designed to handle asynchronous requests on demand using a worker thread. It processes each Intent sequentially and stops itself when there are no more requests, making it useful for offloading tasks from the main thread. Developers are encouraged to use WorkManager as an alternative due to background execution limits introduced in Android 8.0 (API level 26).

Uploaded by

Patito Feo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 122

Firefox https://developer.android.

com/reference/android/app/IntentService

Added in API level 3 (/guide/topics/manifest/uses-sdk-element#ApiLevels)


Deprecated in API level 30 (/guide/topics/manifest/uses-sdk-element#ApiLevels)
Kotlin (/reference/kotlin/android/app/IntentService) | Java

(/reference/android/app/Service)

java.lang.Object (/reference/java/lang/Object)
↳ android.content.Context (/reference/android/content/Context)
↳ android.content.ContextWrapper (/reference/android/content/ContextWrapper)
↳ android.app.Service (/reference/android/app/Service)
↳ android.app.IntentService

This class was deprecated in API level 30.


IntentService is subject to all the background execution limits (/about/versions/oreo/background) imposed with Android 8.0 (API level 26). Consider
using (h�ps://developer.android.com/reference/androidx/work/WorkManager.html) instead.

IntentService is an extension of the (/reference/android/app/Service) component class that handles asynchronous requests
(expressed as (/reference/android/content/Intent) s) on demand. Clients send requests through
(/reference/android/content/Context#sta�Service(android.content.Intent)) calls; the service is sta�ed as needed, handles each Intent in turn
using a worker thread, and stops itself when it runs out of work.

This "work queue processor" pa�ern is commonly used to o�oad tasks from an application's main thread. The IntentService class
exists to simplify this pa�ern and take care of the mechanics. To use it, extend IntentService and implement

1 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/app/IntentService#onHandleIntent(android.content.Intent)) . IntentService
will receive the Intents, launch a worker thread, and stop the service as appropriate.

All requests are handled on a single worker thread -- they may take as long as necessary (and will not block the application's main
loop), but only one request will be processed at a time.

For a detailed discussion about how to create services, read the Services (/guide/components/services) developer guide.

See also:

(h�ps://developer.android.com/reference/androidx/core/app/JobIntentService.html)

Inherited constants

From class (/reference/android/app/Service)


(/reference/android/app/Service#START_CONTINUATION_MASK)

Bits returned by
(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int)) describing how to
continue the service if it is killed.

(/reference/android/app/Service#START_FLAG_REDELIVERY)

2 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

This �ag is set in


(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int)) if the Intent is a re-
delivery of a previously delivered intent, because the service had previously returned
(/reference/android/app/Service#START_REDELIVER_INTENT) but had been killed before calling
(/reference/android/app/Service#stopSelf(int)) for that Intent.

(/reference/android/app/Service#START_FLAG_RETRY)

This �ag is set in


(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int)) if the Intent is a retry
because the original a�empt never got to or returned from
(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int)).

(/reference/android/app/Service#START_NOT_STICKY)

Constant to return from


(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int)): if this service's
process is killed while it is sta�ed (a�er returning from
(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int))), and there are no new
sta� intents to deliver to it, then take the service out of the sta�ed state and don't recreate until a future explicit
call to
(/reference/android/content/Context#sta�Service(android.content.Intent)).

(/reference/android/app/Service#START_REDELIVER_INTENT)

Constant to return from


(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int)): if this service's
process is killed while it is sta�ed (a�er returning from
(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int))), then it will be
scheduled for a resta� and the last delivered Intent re-delivered to it again via
(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int)).

3 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/app/Service#START_STICKY)

Constant to return from


(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int)): if this service's
process is killed while it is sta�ed (a�er returning from
(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int))), then leave it in the
sta�ed state but don't retain this delivered intent.

(/reference/android/app/Service#START_STICKY_COMPATIBILITY)

Constant to return from


(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int)): compatibility version
of (/reference/android/app/Service#START_STICKY) that does not guarantee that

(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int)) will be called again


a�er being killed.

(/reference/android/app/Service#STOP_FOREGROUND_DETACH)

Selector for (/reference/android/app/Service#stopForeground(int)): if set, the noti�cation


previously supplied to
(/reference/android/app/Service#sta�Foreground(int,%20android.app.Noti�cation)) will be detached from the
service's lifecycle.

(/reference/android/app/Service#STOP_FOREGROUND_LEGACY)

This constant was deprecated in API level 33. Use


(/reference/android/app/Service#STOP_FOREGROUND_DETACH) instead. The legacy behavior was inconsistent,
leading to bugs around unpredictable results.

(/reference/android/app/Service#STOP_FOREGROUND_REMOVE)

Selector for (/reference/android/app/Service#stopForeground(int)): if supplied, the

4 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

noti�cation previously supplied to


(/reference/android/app/Service#sta�Foreground(int,%20android.app.Noti�cation)) will be cancelled and
removed from display.

From class (/reference/android/content/Context)


(/reference/java/lang/String) (/reference/android/content/Context#ACCESSIBILITY_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/view/accessibility/AccessibilityManager) for giving the user
feedback for UI events through the registered event listeners.

(/reference/java/lang/String)
(/reference/android/content/Context#ACCOUNT_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/accounts/AccountManager) for receiving intents at a time of your choosing.

(/reference/java/lang/String)
(/reference/android/content/Context#ACTIVITY_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/ActivityManager) for interacting with the global system state.

(/reference/java/lang/String)
(/reference/android/content/Context#ALARM_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/AlarmManager) for receiving intents at a time of your choosing.

(/reference/java/lang/String)
(/reference/android/content/Context#APPWIDGET_SERVICE)

5 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/appwidget/AppWidgetManager) for accessing AppWidgets.

(/reference/java/lang/String)
(/reference/android/content/Context#APP_OPS_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/AppOpsManager) for tracking application operations on the device.

(/reference/java/lang/String)
(/reference/android/content/Context#APP_SEARCH_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve an
(/reference/android/app/appsearch/AppSearchManager) for indexing and querying app data managed by the
system.

(/reference/java/lang/String)
(/reference/android/content/Context#AUDIO_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/media/AudioManager) for handling management of volume, ringer modes and audio
routing.

(/reference/java/lang/String)
(/reference/android/content/Context#BATTERY_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/os/Ba�eryManager) for managing ba�ery state.

(/reference/android/content/Context#BIND_ABOVE_CLIENT)

6 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Flag for
(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
: indicates that the client application binding to this service considers the service to be more impo�ant than the
app itself.

(/reference/android/content/Context#BIND_ADJUST_WITH_ACTIVITY)

Flag for
(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
: If binding from an activity, allow the target service's process impo�ance to be raised based on whether the
activity is visible to the user, regardless whether another �ag is used to reduce the amount that the client
process's overall impo�ance is used to impact it.

(/reference/android/content/Context#BIND_ALLOW_ACTIVITY_STARTS)

Flag for
(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
: If binding from an app that is visible, the bound service is allowed to sta� an activity from background.

(/reference/android/content/Context#BIND_ALLOW_OOM_MANAGEMENT)

Flag for
(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
: allow the process hosting the bound service to go through its normal memory management.

7 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context#BIND_AUTO_CREATE)

Flag for
(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
: automatically create the service as long as the binding exists.

(/reference/android/content/Context#BIND_DEBUG_UNBIND)

Flag for
(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
: include debugging help for mismatched calls to unbind.

(/reference/android/content/Context#BIND_EXTERNAL_SERVICE)

Flag for
(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
: The service being bound is an (/reference/android/R.a�r#isolatedProcess),
(/reference/android/R.a�r#externalService) service.

(/reference/android/content/Context#BIND_EXTERNAL_SERVICE_LONG)

Works in the same way as


(/reference/android/content/Context#BIND_EXTERNAL_SERVICE), but it's de�ned as a value that is
compatible to (/reference/android/content/Context.BindServiceFlags).

(/reference/android/content/Context#BIND_IMPORTANT)

8 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Flag for
(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
: this service is very impo�ant to the client, so should be brought to the foreground process level when the
client is.

(/reference/android/content/Context#BIND_INCLUDE_CAPABILITIES)

Flag for
(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
: If binding from an app that has speci�c capabilities due to its foreground state such as an activity or
foreground service, then this �ag will allow the bound app to get the same capabilities, as long as it has the
required permissions as well.

(/reference/android/content/Context#BIND_NOT_FOREGROUND)

Flag for
(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
: don't allow this binding to raise the target service's process to the foreground scheduling priority.

9 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context#BIND_NOT_PERCEPTIBLE)

Flag for
(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
: If binding from an app that is visible or user-perceptible, lower the target service's impo�ance to below the
perceptible level.

(/reference/android/content/Context#BIND_SHARED_ISOLATED_PROCESS)

Flag for

(/reference/android/content/Context#bindIsolatedService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.lang.String,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
: Bind the service into a shared isolated process.

(/reference/android/content/Context#BIND_WAIVE_PRIORITY)

Flag for
(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
: don't impact the scheduling or memory management priority of the target service's hosting process.

10 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/lang/String)
(/reference/android/content/Context#BIOMETRIC_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/hardware/biometrics/BiometricManager) for handling biometric and PIN/pa�ern/password
authentication.

(/reference/java/lang/String)
(/reference/android/content/Context#BLOB_STORE_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/blob/BlobStoreManager) for contributing and accessing data blobs from the blob store
maintained by the system.

(/reference/java/lang/String)
(/reference/android/content/Context#BLUETOOTH_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/bluetooth/BluetoothManager) for using Bluetooth.

(/reference/java/lang/String)
(/reference/android/content/Context#BUGREPORT_SERVICE)

Service to capture a bugrepo�.

(/reference/java/lang/String)
(/reference/android/content/Context#CAMERA_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/hardware/camera2/CameraManager) for interacting with camera devices.

(/reference/java/lang/String)
(/reference/android/content/Context#CAPTIONING_SERVICE)

11 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/view/accessibility/CaptioningManager) for obtaining captioning prope�ies and listening for
changes in captioning preferences.

(/reference/java/lang/String)
(/reference/android/content/Context#CARRIER_CONFIG_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/telephony/CarrierCon�gManager) for reading carrier
con�guration values.

(/reference/java/lang/String)
(/reference/android/content/Context#CLIPBOARD_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/content/ClipboardManager) for accessing and modifying the contents of the global
clipboard.

(/reference/java/lang/String)
(/reference/android/content/Context#COMPANION_DEVICE_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/companion/CompanionDeviceManager) for managing
companion devices

(/reference/java/lang/String)
(/reference/android/content/Context#CONNECTIVITY_DIAGNOSTICS_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/net/ConnectivityDiagnosticsManager) for

12 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

pe�orming network connectivity diagnostics as well as receiving network connectivity information from the
system.

(/reference/java/lang/String)
(/reference/android/content/Context#CONNECTIVITY_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/net/ConnectivityManager) for handling management of network
connections.

(/reference/java/lang/String)
(/reference/android/content/Context#CONSUMER_IR_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/hardware/ConsumerIrManager) for transmi�ing infrared signals from the device.

(/reference/android/content/Context#CONTEXT_IGNORE_SECURITY)

Flag for use with


(/reference/android/content/Context#createPackageContext(java.lang.String,%20int)): ignore any security
restrictions on the Context being requested, allowing it to always be loaded.

(/reference/android/content/Context#CONTEXT_INCLUDE_CODE)

Flag for use with


(/reference/android/content/Context#createPackageContext(java.lang.String,%20int)): include the application
code with the context.

13 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context#CONTEXT_RESTRICTED)

Flag for use with


(/reference/android/content/Context#createPackageContext(java.lang.String,%20int)): a restricted context may
disable speci�c features.

(/reference/java/lang/String)
(/reference/android/content/Context#CREDENTIAL_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/credentials/CredentialManager) to authenticate a user to your app.

(/reference/java/lang/String)
(/reference/android/content/Context#CROSS_PROFILE_APPS_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/content/pm/CrossPro�leApps) for cross pro�le operations.

(/reference/android/content/Context#DEVICE_ID_DEFAULT)

The default device ID, which is the ID of the primary (non-vi�ual) device.

(/reference/android/content/Context#DEVICE_ID_INVALID)

Invalid device ID.

(/reference/java/lang/String)
(/reference/android/content/Context#DEVICE_LOCK_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/devicelock/DeviceLockManager).

14 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/lang/String)
(/reference/android/content/Context#DEVICE_POLICY_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/admin/DevicePolicyManager) for working with global device
policy management.

(/reference/java/lang/String)
(/reference/android/content/Context#DISPLAY_HASH_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to access
(/reference/android/view/displayhash/DisplayHashManager) to handle display hashes.

(/reference/java/lang/String)
(/reference/android/content/Context#DISPLAY_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/hardware/display/DisplayManager) for interacting with display devices.

(/reference/java/lang/String)
(/reference/android/content/Context#DOMAIN_VERIFICATION_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to access
(/reference/android/content/pm/verify/domain/DomainVeri�cationManager) to
retrieve approval and user state for declared web domains.

(/reference/java/lang/String)
(/reference/android/content/Context#DOWNLOAD_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/DownloadManager) for requesting HTTP downloads.

15 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/lang/String)
(/reference/android/content/Context#DROPBOX_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/os/DropBoxManager) instance for recording diagnostic logs.

(/reference/java/lang/String)
(/reference/android/content/Context#EUICC_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/telephony/euicc/EuiccManager) to manage the device eUICC (embedded SIM).

(/reference/java/lang/String)
(/reference/android/content/Context#FILE_INTEGRITY_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve an
(/reference/android/security/FileIntegrityManager).

(/reference/java/lang/String)
(/reference/android/content/Context#FINGERPRINT_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/hardware/�ngerprint/FingerprintManager) for handling management of �ngerprints.

(/reference/java/lang/String)
(/reference/android/content/Context#GAME_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/GameManager).

(/reference/java/lang/String)
(/reference/android/content/Context#GRAMMATICAL_INFLECTION_SERVICE)

16 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/GrammaticalIn�ectionManager).

(/reference/java/lang/String)
(/reference/android/content/Context#HARDWARE_PROPERTIES_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/os/HardwarePrope�iesManager) for accessing the
hardware prope�ies service.

(/reference/java/lang/String)
(/reference/android/content/Context#HEALTHCONNECT_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/health/connect/HealthConnectManager).

(/reference/java/lang/String)
(/reference/android/content/Context#INPUT_METHOD_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/view/inputmethod/InputMethodManager) for accessing input methods.

(/reference/java/lang/String)
(/reference/android/content/Context#INPUT_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/hardware/input/InputManager) for interacting with input devices.

(/reference/java/lang/String)
(/reference/android/content/Context#IPSEC_SERVICE)

Use with

17 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/net/IpSecManager) for encrypting Sockets or Networks with IPSec.

(/reference/java/lang/String)
(/reference/android/content/Context#JOB_SCHEDULER_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/job/JobScheduler) instance for managing occasional background tasks.

(/reference/java/lang/String)
(/reference/android/content/Context#KEYGUARD_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/KeyguardManager) for controlling keyguard.

(/reference/java/lang/String)
(/reference/android/content/Context#LAUNCHER_APPS_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/content/pm/LauncherApps) for querying and monitoring launchable apps across pro�les of
a user.

(/reference/java/lang/String)
(/reference/android/content/Context#LAYOUT_INFLATER_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/view/LayoutIn�ater) for in�ating layout resources in this context.

18 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/lang/String)
(/reference/android/content/Context#LOCALE_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/LocaleManager).

(/reference/java/lang/String)
(/reference/android/content/Context#LOCATION_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/location/LocationManager) for controlling location updates.

(/reference/java/lang/String)
(/reference/android/content/Context#MEDIA_COMMUNICATION_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/media/MediaCommunicationManager) for managing
(/reference/android/media/MediaSession2).

(/reference/java/lang/String)
(/reference/android/content/Context#MEDIA_METRICS_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/media/metrics/MediaMetricsManager) for interacting with media
metrics on the device.

(/reference/java/lang/String)
(/reference/android/content/Context#MEDIA_PROJECTION_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/media/projection/MediaProjectionManager) instance for
managing media projection sessions.

19 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/lang/String)
(/reference/android/content/Context#MEDIA_ROUTER_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.Class<T>)) to retrieve a
(/reference/android/media/MediaRouter) for controlling and managing routing of media.

(/reference/java/lang/String)
(/reference/android/content/Context#MEDIA_SESSION_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/media/session/MediaSessionManager) for managing media
Sessions.

(/reference/java/lang/String)
(/reference/android/content/Context#MIDI_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/media/midi/MidiManager) for accessing the MIDI service.

(/reference/android/content/Context#MODE_APPEND)

File creation mode: for use with


(/reference/android/content/Context#openFileOutput(java.lang.String,%20int)), if the �le already exists then
write data to the end of the existing �le instead of erasing it.

(/reference/android/content/Context#MODE_ENABLE_WRITE_AHEAD_LOGGING)

Database open �ag: when set, the database is opened with write-ahead logging enabled by default.

(/reference/android/content/Context#MODE_MULTI_PROCESS)

20 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

This constant was deprecated in API level 23. MODE_MULTI_PROCESS does not work reliably in some versions
of Android, and fu�hermore does not provide any mechanism for reconciling concurrent modi�cations across
processes. Applications should not a�empt to use it. Instead, they should use an explicit cross-process data
management approach such as (/reference/android/content/ContentProvider).

(/reference/android/content/Context#MODE_NO_LOCALIZED_COLLATORS)

Database open �ag: when set, the database is opened without suppo� for localized collators.

(/reference/android/content/Context#MODE_PRIVATE)

File creation mode: the default mode, where the created �le can only be accessed by the calling application (or
all applications sharing the same user ID).

(/reference/android/content/Context#MODE_WORLD_READABLE)

This constant was deprecated in API level 17. Creating world-readable �les is very dangerous, and likely to cause
security holes in applications. It is strongly discouraged; instead, applications should use more formal
mechanism for interactions such as (/reference/android/content/ContentProvider),
(/reference/android/content/BroadcastReceiver), and
(/reference/android/app/Service). There are no guarantees that this access mode will remain on a �le, such as
when it goes through a backup and restore.

(/reference/android/content/Context#MODE_WORLD_WRITEABLE)

This constant was deprecated in API level 17. Creating world-writable �les is very dangerous, and likely to cause
security holes in applications. It is strongly discouraged; instead, applications should use more formal
mechanism for interactions such as (/reference/android/content/ContentProvider),
(/reference/android/content/BroadcastReceiver), and
(/reference/android/app/Service). There are no guarantees that this access mode will remain on a �le, such as
when it goes through a backup and restore.

21 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/lang/String)
(/reference/android/content/Context#NETWORK_STATS_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/usage/NetworkStatsManager) for querying network usage
stats.

(/reference/java/lang/String)
(/reference/android/content/Context#NFC_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/nfc/NfcManager) for using NFC.

(/reference/java/lang/String)
(/reference/android/content/Context#NOTIFICATION_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/Noti�cationManager) for informing the user of background
events.

(/reference/java/lang/String)
(/reference/android/content/Context#NSD_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/net/nsd/NsdManager) for handling management of network service discovery

(/reference/java/lang/String)
(/reference/android/content/Context#OVERLAY_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/content/om/OverlayManager) for managing overlay packages.

22 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/lang/String)
(/reference/android/content/Context#PEOPLE_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to access a
(/reference/android/app/people/PeopleManager) to interact with your published conversations.

(/reference/java/lang/String)
(/reference/android/content/Context#PERFORMANCE_HINT_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/os/Pe�ormanceHintManager) for accessing the pe�ormance
hinting service.

(/reference/java/lang/String)
(/reference/android/content/Context#POWER_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/os/PowerManager) for controlling power management, including "wake locks," which let
you keep the device on while you're running long tasks.

(/reference/java/lang/String)
(/reference/android/content/Context#PRINT_SERVICE)

(/reference/android/print/PrintManager) for printing and managing printers and print tasks.

(/reference/android/content/Context#RECEIVER_EXPORTED)

Flag for
(/reference/android/content/Context#registerReceiver(android.content.BroadcastReceiver,
%20android.content.IntentFilter))
: The receiver can receive broadcasts from other Apps.

(/reference/android/content/Context#RECEIVER_NOT_EXPORTED)

23 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Flag for
(/reference/android/content/Context#registerReceiver(android.content.BroadcastReceiver,
%20android.content.IntentFilter))
: The receiver cannot receive broadcasts from other Apps.

(/reference/android/content/Context#RECEIVER_VISIBLE_TO_INSTANT_APPS)

Flag for
(/reference/android/content/Context#registerReceiver(android.content.BroadcastReceiver,
%20android.content.IntentFilter))
: The receiver can receive broadcasts from Instant Apps.

(/reference/java/lang/String)
(/reference/android/content/Context#RESTRICTIONS_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/content/RestrictionsManager) for retrieving application
restrictions and requesting permissions for restricted operations.

(/reference/java/lang/String)
(/reference/android/content/Context#ROLE_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/role/RoleManager) for managing roles.

(/reference/java/lang/String)
(/reference/android/content/Context#SEARCH_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/SearchManager) for handling searches.

24 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/lang/String)
(/reference/android/content/Context#SENSOR_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/hardware/SensorManager) for accessing sensors.

(/reference/java/lang/String)
(/reference/android/content/Context#SHORTCUT_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/content/pm/Sho�cutManager) for accessing the launcher sho�cut service.

(/reference/java/lang/String)
(/reference/android/content/Context#STATUS_BAR_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/StatusBarManager) for interacting with the status bar and quick se�ings.

(/reference/java/lang/String)
(/reference/android/content/Context#STORAGE_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/os/storage/StorageManager) for accessing system storage functions.

(/reference/java/lang/String)
(/reference/android/content/Context#STORAGE_STATS_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/usage/StorageStatsManager) for accessing system storage
statistics.

(/reference/java/lang/String)
(/reference/android/content/Context#SYSTEM_HEALTH_SERVICE)

25 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/os/health/SystemHealthManager) for accessing system health
(ba�ery, power, memory, etc) metrics.

(/reference/java/lang/String)
(/reference/android/content/Context#TELECOM_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/telecom/TelecomManager) to manage telecom-related features of the device.

(/reference/java/lang/String)
(/reference/android/content/Context#TELEPHONY_IMS_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve an
(/reference/android/telephony/ims/ImsManager).

(/reference/java/lang/String)
(/reference/android/content/Context#TELEPHONY_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/telephony/TelephonyManager) for handling management the telephony features of the
device.

(/reference/java/lang/String)
(/reference/android/content/Context#TELEPHONY_SUBSCRIPTION_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/telephony/SubscriptionManager) for handling management the
telephony subscriptions of the device.

26 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/lang/String)
(/reference/android/content/Context#TEXT_CLASSIFICATION_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/view/textclassi�er/TextClassi�cationManager) for text
classi�cation services.

(/reference/java/lang/String)
(/reference/android/content/Context#TEXT_SERVICES_MANAGER_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/view/textservice/TextServicesManager) for accessing text
services.

(/reference/java/lang/String)
(/reference/android/content/Context#TV_INPUT_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/media/tv/TvInputManager) for interacting with TV inputs on the device.

(/reference/java/lang/String)
(/reference/android/content/Context#TV_INTERACTIVE_APP_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/media/tv/interactive/TvInteractiveAppManager) for
interacting with TV interactive applications on the device.

27 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/lang/String)
(/reference/android/content/Context#UI_MODE_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/UiModeManager) for controlling UI modes.

(/reference/java/lang/String)
(/reference/android/content/Context#USAGE_STATS_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/app/usage/UsageStatsManager) for querying device usage stats.

(/reference/java/lang/String)
(/reference/android/content/Context#USB_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/hardware/usb/UsbManager) for access to USB devices (as a USB host) and for controlling
this device's behavior as a USB device.

(/reference/java/lang/String)
(/reference/android/content/Context#USER_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/os/UserManager) for managing users on devices that suppo� multiple users.

(/reference/java/lang/String)
(/reference/android/content/Context#VIBRATOR_MANAGER_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/os/VibratorManager) for accessing the device vibrators, interacting with individual ones and
playing synchronized e�ects on multiple vibrators.

28 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/lang/String)
(/reference/android/content/Context#VIBRATOR_SERVICE)

This constant was deprecated in API level 31. Use (/reference/android/os/VibratorManager)


to retrieve the default system vibrator.

(/reference/java/lang/String)
(/reference/android/content/Context#VIRTUAL_DEVICE_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/companion/vi�ual/Vi�ualDeviceManager) for managing vi�ual
devices.

(/reference/java/lang/String)
(/reference/android/content/Context#VPN_MANAGEMENT_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/net/VpnManager) to manage pro�les for the pla�orm built-in VPN.

(/reference/java/lang/String)
(/reference/android/content/Context#WALLPAPER_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
com.android.server.WallpaperService for accessing wallpapers.

(/reference/java/lang/String)
(/reference/android/content/Context#WIFI_AWARE_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/net/wi�/aware/Wi�AwareManager) for handling management of Wi-Fi Aware.

(/reference/java/lang/String)
(/reference/android/content/Context#WIFI_P2P_SERVICE)

29 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/net/wi�/p2p/Wi�P2pManager) for handling management of Wi-Fi peer-to-peer
connections.

(/reference/java/lang/String)
(/reference/android/content/Context#WIFI_RTT_RANGING_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/net/wi�/�t/Wi�R�Manager) for ranging devices with wi�.

(/reference/java/lang/String)
(/reference/android/content/Context#WIFI_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/net/wi�/Wi�Manager) for handling management of Wi-Fi access.

(/reference/java/lang/String) (/reference/android/content/Context#WINDOW_SERVICE)

Use with
(/reference/android/content/Context#getSystemService(java.lang.String)) to retrieve a
(/reference/android/view/WindowManager) for accessing the system's window manager.

From inte�ace (/reference/android/content/ComponentCallbacks2)


(/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_BACKGROUND)

Level for (/reference/android/content/ComponentCallbacks2#onTrimMemory(int)): the


process has gone on to the LRU list.

(/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_COMPLETE)

Level for (/reference/android/content/ComponentCallbacks2#onTrimMemory(int)): the

30 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

process is nearing the end of the background LRU list, and if more memory isn't found soon it will be killed.

(/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_MODERATE)

Level for (/reference/android/content/ComponentCallbacks2#onTrimMemory(int)): the


process is around the middle of the background LRU list; freeing memory can help the system keep other
processes running later in the list for be�er overall pe�ormance.

(/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_RUNNING_CRITICAL)

Level for (/reference/android/content/ComponentCallbacks2#onTrimMemory(int)): the


process is not an expendable background process, but the device is running extremely low on memory and is
about to not be able to keep any background processes running.

(/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_RUNNING_LOW)

Level for (/reference/android/content/ComponentCallbacks2#onTrimMemory(int)): the


process is not an expendable background process, but the device is running low on memory.

(/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_RUNNING_MODERATE)

Level for (/reference/android/content/ComponentCallbacks2#onTrimMemory(int)): the


process is not an expendable background process, but the device is running moderately low on memory.

(/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_UI_HIDDEN)

Level for (/reference/android/content/ComponentCallbacks2#onTrimMemory(int)): the


process had been showing a user inte�ace, and is no longer doing so.

31 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Public constructors

(/reference/android/app/IntentService#IntentService(java.lang.String)) (/reference/java/lang/String)

Creates an IntentService.

Public methods

(/reference/android/app/IntentService#onBind(android.content.Intent))
(/reference/android/os/IBinder) (/reference/android/content/Intent)

Unless you provide binding for your service, you don't need to implement this method, because the default
implementation returns null.

(/reference/android/app/IntentService#onCreate())

Called by the system when the service is �rst created.

(/reference/android/app/IntentService#onDestroy())

Called by the system to notify a Service that it is no longer used and is being removed.

(/reference/android/app/IntentService#onSta�(android.content.Intent,%20int))
(/reference/android/content/Intent)

This method was deprecated in API level 30. Implement


(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int)) instead.

32 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/app/IntentService#onSta�Command(android.content.Intent,%20int,%20int))
(/reference/android/content/Intent)

You should not override this method for your IntentService.

(/reference/android/app/IntentService#setIntentRedelivery(boolean))

Sets intent redelivery preferences.

Protected methods

(/reference/android/app/IntentService#onHandleIntent(android.content.Intent))
(/reference/android/content/Intent)

This method is invoked on the worker thread with a request to process.

Inherited methods

From class (/reference/android/app/Service)


(/reference/android/app/Service#a�achBaseContext(android.content.Context)
(/reference/android/content/Context)

Set the base context for this ContextWrapper.

(/reference/android/app/Service#dump(java.io.FileDescriptor,%20java.io.PrintWriter,
%20java.lang.String[]))

33 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/io/FileDescriptor) (/reference/java/io/PrintWr
(/reference/java/lang/String)

Print the Service's state into the given stream.

(/reference/android/app/Application)
(/reference/android/app/Service#getApplication())

Return the application that owns this service.

(/reference/android/app/Service#getForegroundServiceType()

If the service has become a foreground service by calling

(/reference/android/app/Service#sta�Foreground(int,%20android.app.Noti�cation)) or

(/reference/android/app/Service#sta�Foreground(int,%20android.app.Noti�cation,%20int)
(/reference/android/app/Service#getForegroundServiceType()
the current foreground service type.

(/reference/android/os/IBinder)
(/reference/android/app/Service#onBind(android.content.Intent))
(/reference/android/content/Intent)

Return the communication channel to the service.

(/reference/android/app/Service#onCon�gurationChanged(android.content.res.Con�guration)
(/reference/android/content/res/Con�guration)

Called by the system when the device con�guration changes while your component is running.

34 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/app/Service#onCreate())

Called by the system when the service is �rst created.

(/reference/android/app/Service#onDestroy())

Called by the system to notify a Service that it is no longer used and is being removed.

(/reference/android/app/Service#onLowMemory())

This is called when the overall system is running low on memory, and actively running processes shoul
trim their memory usage.

(/reference/android/app/Service#onRebind(android.content.Intent))
(/reference/android/content/Intent)

Called when new clients have connected to the service, a�er it had previously been noti�ed that all ha
disconnected in its
(/reference/android/app/Service#onUnbind(android.content.Intent)).

(/reference/android/app/Service#onSta�(android.content.Intent,%20int))
(/reference/android/content/Intent)

This method was deprecated in API level 15. Implement


(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int
instead.

(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int)
(/reference/android/content/Intent)

Called by the system every time a client explicitly sta�s the service by calling

35 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context#sta�Service(android.content.Intent)), providing the arguments i


supplied and a unique integer token representing the sta� request.

(/reference/android/app/Service#onTaskRemoved(android.content.Intent)
(/reference/android/content/Intent)

This is called if the service is currently running and the user has removed a task that comes from the
service's application.

(/reference/android/app/Service#onTimeout(int))

Callback called on timeout for


(/reference/android/content/pm/ServiceInfo#FOREGROUND_SERVICE_TYPE_SHORT_SERVICE

(/reference/android/app/Service#onTrimMemory(int))

Called when the operating system has determined that it is a good time for a process to trim unneede
memory from its process.

(/reference/android/app/Service#onUnbind(android.content.Intent))
(/reference/android/content/Intent)

Called when all clients have disconnected from a pa�icular inte�ace published by the service.

(/reference/android/app/Service#sta�Foreground(int,%20android.app.Noti�catio
(/reference/android/app/Noti�cation)

If your service is sta�ed (running through


(/reference/android/content/Context#sta�Service(android.content.Intent))), then also make this servi
run in the foreground, supplying the ongoing noti�cation to be shown to the user while in this state.

36 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/app/Service#sta�Foreground(int,%20android.app.Noti�cation,%20int)
(/reference/android/app/Noti�cation)

An overloaded version of
(/reference/android/app/Service#sta�Foreground(int,%20android.app.Noti�cation)) with additional
foregroundServiceType parameter.

(/reference/android/app/Service#stopForeground(int))

Remove this service from foreground state, allowing it to be killed if more memory is needed.

(/reference/android/app/Service#stopForeground(boolean))

This method was deprecated in API level 33. call


(/reference/android/app/Service#stopForeground(int)) and pass either
(/reference/android/app/Service#STOP_FOREGROUND_REMOVE) or
(/reference/android/app/Service#STOP_FOREGROUND_DETACH) explicitly instead.

(/reference/android/app/Service#stopSelf())

Stop the service, if it was previously sta�ed.

(/reference/android/app/Service#stopSelf(int))

Old version of (/reference/android/app/Service#stopSelfResult(int)


return a result.

(/reference/android/app/Service#stopSelfResult(int))

37 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Stop the service if the most recent time it was sta�ed was sta�Id.

From class (/reference/android/content/ContextWrapper)

(/reference/android/content/ContextWrapper#a�achBaseContext(android.content.Conte
(/reference/android/content/Context)

Set the base context for this ContextWrapper.

(/reference/android/content/ContextWrapper#bindIsolatedService(android.content.Inten
%20int,%20java.lang.String,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
(/reference/android/content/Intent)
(/reference/java/lang/String)
(/reference/java/util/concurrent/Executor)
(/reference/android/content/ServiceConnection)

Variation of

(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
that, in the speci�c case of isolated services, allows the caller to generate multiple instan
of a service from a single component declaration.

(/reference/android/content/ContextWrapper#bindService(android.content.Intent,%20int
%20java.util.concurrent.Executor,%20android.content.ServiceConnection))
(/reference/android/content/Intent)
(/reference/java/util/concurrent/Executor)
(/reference/android/content/ServiceConnection)

38 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Same as
(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.ServiceConnection,%20int))
with executor to control ServiceConnection callbacks.

(/reference/android/content/ContextWrapper#bindService(android.content.Intent,
%20android.content.ServiceConnection,%20android.content.Context.BindServiceFlags)
(/reference/android/content/Intent)
(/reference/android/content/ServiceConnection)
(/reference/android/content/Context.BindServiceFlags)

See

(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.ServiceConnection,%20int))
Call
(/reference/android/content/Context.BindServiceFlags#of(long)) to obtain a BindServiceF
object.

(/reference/android/content/ContextWrapper#bindService(android.content.Intent,
%20android.content.ServiceConnection,%20int))
(/reference/android/content/Intent)
(/reference/android/content/ServiceConnection)

Connects to an application service, creating it if needed.

(/reference/android/content/ContextWrapper#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
(/reference/android/content/Intent)

39 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context.BindServiceFlags)
(/reference/java/util/concurrent/Executor)
(/reference/android/content/ServiceConnection)

See

(/reference/android/content/Context#bindService(android.content.Intent,%20int,
%20java.util.concurrent.Executor,%20android.content.ServiceConnection))
Call
(/reference/android/content/Context.BindServiceFlags#of(long)) to obtain a BindServiceF
object.

(/reference/android/content/
ContextWrapper#checkCallingOrSelfPermission(java.lang.String))
(/reference/java/lang/String)

Determine whether the calling process of an IPC or you have been granted a pa�icular
permission.

(/reference/android/content/
ContextWrapper#checkCallingOrSelfUriPermission(android.net.Uri,%20int))
(/reference/android/net/Uri)

Determine whether the calling process of an IPC or you has been granted permission to
access a speci�c URI.

(/reference/android/content/
ContextWrapper#checkCallingOrSelfUriPermissions(java.util.List<android.net.Uri>,%20int
(/reference/java/util/List) (/reference/android/net/Uri)

40 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Determine whether the calling process of an IPC or you has been granted permission to
access a list of URIs.

(/reference/android/content/ContextWrapper#checkCallingPermission(java.lang.String)
(/reference/java/lang/String)

Determine whether the calling process of an IPC you are handling has been granted a
pa�icular permission.

(/reference/android/content/ContextWrapper#checkCallingUriPermission(android.net.Uri
%20int))
(/reference/android/net/Uri)

Determine whether the calling process and user ID has been granted permission to acces
speci�c URI.

(/reference/android/content/
ContextWrapper#checkCallingUriPermissions(java.util.List<android.net.Uri>,%20int)
(/reference/java/util/List) (/reference/android/net/Uri)

Determine whether the calling process and user ID has been granted permission to acces
list of URIs.

(/reference/android/content/ContextWrapper#checkPermission(java.lang.String,%20int,
%20int))
(/reference/java/lang/String)

41 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Determine whether the given permission is allowed for a pa�icular process and user ID
running in the system.

(/reference/android/content/ContextWrapper#checkSelfPermission(java.lang.String)
(/reference/java/lang/String)

Determine whether you have been granted a pa�icular permission.

(/reference/android/content/ContextWrapper#checkUriPermission(android.net.Uri,
%20java.lang.String,%20java.lang.String,%20int,%20int,%20int))
(/reference/android/net/Uri) (/reference/java/lang/String
(/reference/java/lang/String)

Check both a Uri and normal permission.

(/reference/android/content/ContextWrapper#checkUriPermission(android.net.Uri,%20in
%20int,%20int))
(/reference/android/net/Uri)

Determine whether a pa�icular process and user ID has been granted permission to acce
speci�c URI.

(/reference/android/content/
ContextWrapper#checkUriPermissions(java.util.List<android.net.Uri>,%20int,%20int,%20
(/reference/java/util/List) (/reference/android/net/Uri)

42 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Determine whether a pa�icular process and user ID has been granted permission to acce
list of URIs.

(/reference/android/content/ContextWrapper#clearWallpaper()

This method is deprecated. Use


(/reference/android/app/WallpaperManager#clear()) instead.

This method requires the caller to hold the permission

(/reference/android/Manifest.permission#SET_WALLPAPER).

(/reference/android/content/Context)
(/reference/android/content/ContextWrapper#createA�ributionContext(java.lang.String)
(/reference/java/lang/String)

Return a new Context object for the current Context but a�ribute to a di�erent tag.

(/reference/android/content/Context)
(/reference/android/content/
ContextWrapper#createCon�gurationContext(android.content.res.Con�guration)
(/reference/android/content/res/Con�guration)

Return a new Context object for the current Context but whose resources are adjusted to
match the given Con�guration.

43 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context)
(/reference/android/content/
ContextWrapper#createContext(android.content.ContextParams))
(/reference/android/content/ContextParams)

Creates a context with speci�c prope�ies and behaviors.

(/reference/android/content/Context)
(/reference/android/content/ContextWrapper#createDeviceContext(int))

Returns a new object from the current context but with device association given
the .

(/reference/android/content/Context)
(/reference/android/content/ContextWrapper#createDeviceProtectedStorageContext()

Return a new Context object for the current Context but whose storage APIs are backed b
device-protected storage.

(/reference/android/content/Context)
(/reference/android/content/ContextWrapper#createDisplayContext(android.view.Display
(/reference/android/view/Display)

Returns a new object from the current context but with resources adjusted to m
the metrics of .

(/reference/android/content/Context)
(/reference/android/content/ContextWrapper#createPackageContext(java.lang.String,
%20int))
(/reference/java/lang/String)

Return a new Context object for the given application name.

44 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context)
(/reference/android/content/ContextWrapper#createWindowContext(int,
%20android.os.Bundle))
(/reference/android/os/Bundle)

Creates a Context for a non-activity window.

(/reference/android/content/Context)
(/reference/android/content/ContextWrapper#createWindowContext(android.view.Displa
%20int,%20android.os.Bundle))
(/reference/android/view/Display)
(/reference/android/os/Bundle)

Creates a for a non- (/reference/android/app/Activity) window on the


given (/reference/android/view/Display).

(/reference/java/lang/String)
(/reference/android/content/ContextWrapper#databaseList()

Returns an array of strings naming the private databases associated with this Context's
application package.

(/reference/android/content/ContextWrapper#deleteDatabase(java.lang.String)
(/reference/java/lang/String)

Delete an existing private SQLiteDatabase associated with this Context's application pack

(/reference/android/content/ContextWrapper#deleteFile(java.lang.String)
(/reference/java/lang/String)

Delete the given private �le associated with this Context's application package.

45 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/ContextWrapper#deleteSharedPreferences(java.lang.String)
(/reference/java/lang/String)

Delete an existing shared preferences �le.

(/reference/android/content/
ContextWrapper#enforceCallingOrSelfPermission(java.lang.String,%20java.lang.String)
(/reference/java/lang/String) (/reference/java/lang/Stri

If neither you nor the calling process of an IPC you are handling has been granted a pa�ic
permission, throw a (/reference/java/lang/SecurityException

(/reference/android/content/
ContextWrapper#enforceCallingOrSelfUriPermission(android.net.Uri,%20int,
%20java.lang.String))
(/reference/android/net/Uri)
(/reference/java/lang/String)

If the calling process of an IPC or you has not been granted permission to access a speci
URI, throw (/reference/java/lang/SecurityException).

46 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/ContextWrapper#enforceCallingPermission(java.lang.String,
%20java.lang.String))
(/reference/java/lang/String) (/reference/java/lang/Stri

If the calling process of an IPC you are handling has not been granted a pa�icular permis
throw a (/reference/java/lang/SecurityException).

(/reference/android/content/ContextWrapper#enforceCallingUriPermission(android.net.U
%20int,%20java.lang.String))
(/reference/android/net/Uri)
(/reference/java/lang/String)

If the calling process and user ID has not been granted permission to access a speci�c U
throw (/reference/java/lang/SecurityException).

(/reference/android/content/ContextWrapper#enforcePermission(java.lang.String,%20int
%20int,%20java.lang.String))
(/reference/java/lang/String)
(/reference/java/lang/String)

If the given permission is not allowed for a pa�icular process and user ID running in the
system, throw a (/reference/java/lang/SecurityException

(/reference/android/content/ContextWrapper#enforceUriPermission(android.net.Uri,
%20java.lang.String,%20java.lang.String,%20int,%20int,%20int,%20java.lang.String)
(/reference/android/net/Uri) (/reference/java/lang/String
(/reference/java/lang/String)
(/reference/java/lang/String)

47 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Enforce both a Uri and normal permission.

(/reference/android/content/ContextWrapper#enforceUriPermission(android.net.Uri,%20
%20int,%20int,%20java.lang.String))
(/reference/android/net/Uri)
(/reference/java/lang/String)

If a pa�icular process and user ID has not been granted permission to access a speci�c U
throw (/reference/java/lang/SecurityException).

(/reference/java/lang/String)
(/reference/android/content/ContextWrapper#�leList())

Returns an array of strings naming the private �les associated with this Context's applica
package.

(/reference/android/content/Context)
(/reference/android/content/ContextWrapper#getApplicationContext())

Return the context of the single, global Application object of the current process.

(/reference/android/content/pm/ApplicationInfo)
(/reference/android/content/ContextWrapper#getApplicationInfo

Return the full application info for this context's package.

(/reference/android/content/res/AssetManager)
(/reference/android/content/ContextWrapper#getAssets())

Returns an AssetManager instance for the application's package.

48 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/A�ributionSource)
(/reference/android/content/ContextWrapper#getA�ributionSource())

(/reference/android/content/Context)
(/reference/android/content/ContextWrapper#getBaseContext()

(/reference/java/io/File)
(/reference/android/content/ContextWrapper#getCacheDir())

Returns the absolute path to the application speci�c cache directory on the �lesystem.

(/reference/java/lang/ClassLoader)
(/reference/android/content/ContextWrapper#getClassLoader()

Return a class loader you can use to retrieve classes in this package.

(/reference/java/io/File)
(/reference/android/content/ContextWrapper#getCodeCacheDir()

Returns the absolute path to the application speci�c cache directory on the �lesystem
designed for storing cached code.

(/reference/android/content/ContentResolver)
(/reference/android/content/ContextWrapper#getContentResolve

Return a ContentResolver instance for your application's package.

(/reference/java/io/File)
(/reference/android/content/ContextWrapper#getDataDir())

Returns the absolute path to the directory on the �lesystem where all private �les belong
to this app are stored.

(/reference/java/io/File)
(/reference/android/content/ContextWrapper#getDatabasePath(java.lang.String)

49 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/lang/String)

Returns the absolute path on the �lesystem where a database created with

(/reference/android/content/Context#openOrCreateDatabase(java.lang.String,%20int,
%20android.database.sqlite.SQLiteDatabase.CursorFactory))
is stored.

(/reference/android/content/ContextWrapper#getDeviceId())

Gets the device ID this context is associated with.

(/reference/java/io/File)
(/reference/android/content/ContextWrapper#getDir(java.lang.String,%20int)
(/reference/java/lang/String)

Retrieve, creating if needed, a new directory in which the application can place its own
custom data �les.

(/reference/android/view/Display)
(/reference/android/content/ContextWrapper#getDisplay())

Get the display this context is associated with.

(/reference/java/io/File)
(/reference/android/content/ContextWrapper#getExternalCacheDir())

Returns absolute path to application-speci�c directory on the primary shared/external


storage device where the application can place cache �les it owns.

50 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/io/File)
(/reference/android/content/ContextWrapper#getExternalCacheDirs())

Returns absolute paths to application-speci�c directories on all shared/external storage


devices where the application can place cache �les it owns.

(/reference/java/io/File)
(/reference/android/content/ContextWrapper#getExternalFilesDir(java.lang.String)
(/reference/java/lang/String)

Returns the absolute path to the directory on the primary shared/external storage device
where the application can place persistent �les it owns.

(/reference/java/io/File)
(/reference/android/content/ContextWrapper#getExternalFilesDirs(java.lang.String)
(/reference/java/lang/String)

Returns absolute paths to application-speci�c directories on all shared/external storage


devices where the application can place persistent �les it owns.

(/reference/java/io/File)
(/reference/android/content/ContextWrapper#getExternalMediaDirs())

This method is deprecated. These directories still exist and are scanned, but developers a
encouraged to migrate to inse�ing content into a
(/reference/android/provider/MediaStore) collection directly, as any app can contribute n
media to (/reference/android/provider/MediaStore) with no permissions
required, sta�ing in
(/reference/android/os/Build.VERSION_CODES#Q).

(/reference/java/io/File)
(/reference/android/content/ContextWrapper#getFileStreamPath(java.lang.String)

51 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/lang/String)

Returns the absolute path on the �lesystem where a �le created with

(/reference/android/content/Context#openFileOutput(java.lang.String,%20int)

(/reference/java/io/File)
(/reference/android/content/ContextWrapper#getFilesDir())

Returns the absolute path to the directory on the �lesystem where �les created with

(/reference/android/content/Context#openFileOutput(java.lang.String,%20int)

(/reference/java/util/concurrent/Executor)
(/reference/android/content/ContextWrapper#getMainExecutor()

Return an (/reference/java/util/concurrent/Executor) that will run enqueued tas


on the main thread associated with this context.

(/reference/android/os/Looper)
(/reference/android/content/ContextWrapper#getMainLooper()

Return the Looper for the main thread of the current process.

(/reference/java/io/File)
(/reference/android/content/ContextWrapper#getNoBackupFilesDir())

Returns the absolute path to the directory on the �lesystem similar to


(/reference/android/content/Context#getFilesDir()).

(/reference/java/io/File)
(/reference/android/content/ContextWrapper#getObbDir())

Return the primary shared/external storage directory where this application's OBB �les (if
there are any) can be found.

52 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/io/File)
(/reference/android/content/ContextWrapper#getObbDirs())

Returns absolute paths to application-speci�c directories on all shared/external storage


devices where the application's OBB �les (if there are any) can be found.

(/reference/java/lang/String)
(/reference/android/content/ContextWrapper#getPackageCodePath())

Return the full path to this context's primary Android package.

(/reference/android/content/pm/PackageManager)
(/reference/android/content/ContextWrapper#getPackageManage

Return PackageManager instance to �nd global package information.

(/reference/java/lang/String)
(/reference/android/content/ContextWrapper#getPackageName()

Return the name of this application's package.

(/reference/java/lang/String)

(/reference/android/content/ContextWrapper#getPackageResourcePath())

Return the full path to this context's primary Android package.

(/reference/android/content/ContextParams)
(/reference/android/content/ContextWrapper#getParams())

Return the set of parameters which this Context was created with, if it was created via

(/reference/android/content/Context#createContext(android.content.ContextParams)

(/reference/android/content/res/Resources)
(/reference/android/content/ContextWrapper#getResources()

53 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Returns a Resources instance for the application's package.

(/reference/android/content/SharedPreferences)

(/reference/android/content/ContextWrapper#getSharedPreferences(java.lang.String,
%20int))
(/reference/java/lang/String)

Retrieve and hold the contents of the preferences �le 'name', returning a SharedPreferen
through which you can retrieve and modify its values.

(/reference/java/lang/Object)
(/reference/android/content/ContextWrapper#getSystemService(java.lang.String)
(/reference/java/lang/String)

Return the handle to a system-level service by name.

(/reference/java/lang/String)
(/reference/android/content/ContextWrapper#getSystemServiceName(java.lang.Class<?>
(/reference/java/lang/Class)

Gets the name of the system-level service that is represented by the speci�ed class.

(/reference/android/content/res/Resources.Theme)
(/reference/android/content/ContextWrapper#getTheme())

Return the Theme object associated with this Context.

(/reference/android/graphics/drawable/Drawable)
(/reference/android/content/ContextWrapper#getWallpaper()

This method is deprecated. Use


(/reference/android/app/WallpaperManager#getDrawable()) instead.

54 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/ContextWrapper#getWallpaperDesiredMinimumHeight()

This method is deprecated. Use


(/reference/android/app/WallpaperManager#getDesiredMinimumHeight()) instead.

(/reference/android/content/ContextWrapper#getWallpaperDesiredMinimumWidth()

This method is deprecated. Use


(/reference/android/app/WallpaperManager#getDesiredMinimumWidth()) instead.

(/reference/android/content/ContextWrapper#grantUriPermission(java.lang.String,
%20android.net.Uri,%20int))
(/reference/java/lang/String) (/reference/android/net/Uri

Grant permission to access a speci�c Uri to another package, regardless of whether that
package has general permission to access the Uri's content provider.

(/reference/android/content/ContextWrapper#isDeviceProtectedStorage())

Indicates if the storage APIs of this Context are backed by device-protected storage.

(/reference/android/content/ContextWrapper#isRestricted())

Indicates whether this Context is restricted.

55 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/ContextWrapper#moveDatabaseFrom(android.content.Cont
%20java.lang.String))
(/reference/android/content/Context)
(/reference/java/lang/String)

Move an existing database �le from the given source storage context to this context.

(/reference/android/content/
ContextWrapper#moveSharedPreferencesFrom(android.content.Context,
%20java.lang.String))
(/reference/android/content/Context)
(/reference/java/lang/String)

Move an existing shared preferences �le from the given source storage context to this
context.

(/reference/java/io/FileInputStream)
(/reference/android/content/ContextWrapper#openFileInput(java.lang.String)
(/reference/java/lang/String)

Open a private �le associated with this Context's application package for reading.

(/reference/java/io/FileOutputStream)

(/reference/android/content/ContextWrapper#openFileOutput(java.lang.String,%20int)
(/reference/java/lang/String)

Open a private �le associated with this Context's application package for writing.

(/reference/android/database/sqlite/SQLiteDatabase)
(/reference/android/content/ContextWrapper#openOrCreateDatabase(java.lang.String,
%20int,%20android.database.sqlite.SQLiteDatabase.CursorFactory,
%20android.database.DatabaseErrorHandler))

56 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/lang/String)
(/reference/android/database/sqlite/SQLiteDatabase.CursorFactory
(/reference/android/database/DatabaseErrorHand

Open a new private SQLiteDatabase associated with this Context's application package.

(/reference/android/database/sqlite/SQLiteDatabase)

(/reference/android/content/ContextWrapper#openOrCreateDatabase(java.lang.String,
%20int,%20android.database.sqlite.SQLiteDatabase.CursorFactory))
(/reference/java/lang/String)
(/reference/android/database/sqlite/SQLiteDatabase.CursorFactory

Open a new private SQLiteDatabase associated with this Context's application package.

(/reference/android/graphics/drawable/Drawable)
(/reference/android/content/ContextWrapper#peekWallpaper()

This method is deprecated. Use


(/reference/android/app/WallpaperManager#peekDrawable()) instead.

(/reference/android/content/
ContextWrapper#registerComponentCallbacks(android.content.ComponentCallbacks)
(/reference/android/content/ComponentCallbacks)

Add a new (/reference/android/content/ComponentCallbacks


base application of the Context, which will be called at the same times as the
ComponentCallbacks methods of activities and other components are called.

57 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/
ContextWrapper#registerDeviceIdChangeListener(java.util.concurrent.Executor,
%20java.util.function.IntConsumer))
(/reference/java/util/concurrent/Executor)
(/reference/java/util/function/IntConsumer)

Adds a new device ID changed listener to the , which will be called when the dev
association is changed by the system.

(/reference/android/content/Intent)
(/reference/android/content/
ContextWrapper#registerReceiver(android.content.BroadcastReceiver,
%20android.content.IntentFilter))
(/reference/android/content/BroadcastReceiver)
(/reference/android/content/IntentFilter)

Register a BroadcastReceiver to be run in the main activity thread.

(/reference/android/content/Intent)
(/reference/android/content/
ContextWrapper#registerReceiver(android.content.BroadcastReceiver,
%20android.content.IntentFilter,%20int))
(/reference/android/content/BroadcastReceiver)
(/reference/android/content/IntentFilter)

Register to receive intent broadcasts, with the receiver optionally being exposed to Instan
Apps.

(/reference/android/content/Intent)

(/reference/android/content/
ContextWrapper#registerReceiver(android.content.BroadcastReceiver,
%20android.content.IntentFilter,%20java.lang.String,%20android.os.Handler,%20int)
(/reference/android/content/BroadcastReceiver)
(/reference/android/content/IntentFilter)

58 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/lang/String)
(/reference/android/os/Handler)

Register to receive intent broadcasts, to run in the context of scheduler.

(/reference/android/content/Intent)
(/reference/android/content/
ContextWrapper#registerReceiver(android.content.BroadcastReceiver,
%20android.content.IntentFilter,%20java.lang.String,%20android.os.Handler)
(/reference/android/content/BroadcastReceiver)
(/reference/android/content/IntentFilter)
(/reference/java/lang/String)
(/reference/android/os/Handler)

Register to receive intent broadcasts, to run in the context of scheduler.

(/reference/android/content/
ContextWrapper#removeStickyBroadcast(android.content.Intent))
(/reference/android/content/Intent)

This method is deprecated. Sticky broadcasts should not be used. They provide no secur
(anyone can access them), no protection (anyone can modify them), and many other
problems. The recommended pa�ern is to use a non-sticky broadcast to repo� that
something has changed, with another mechanism for apps to retrieve the current value
whenever desired.

(/reference/android/content/
ContextWrapper#removeStickyBroadcastAsUser(android.content.Intent,
%20android.os.UserHandle))
(/reference/android/content/Intent)
(/reference/android/os/UserHandle)

59 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

This method is deprecated. Sticky broadcasts should not be used. They provide no secur
(anyone can access them), no protection (anyone can modify them), and many other
problems. The recommended pa�ern is to use a non-sticky broadcast to repo� that
something has changed, with another mechanism for apps to retrieve the current value
whenever desired.

(/reference/android/content/
ContextWrapper#revokeSelfPermissionsOnKill(java.util.Collection<java.lang.String>)
(/reference/java/util/Collection) (/reference/java/lang/String

Triggers the revocation of one or more permissions for the calling package.

(/reference/android/content/ContextWrapper#revokeUriPermission(android.net.Uri,%20in
(/reference/android/net/Uri)

Remove all permissions to access a pa�icular content provider Uri that were previously ad
with
(/reference/android/content/Context#grantUriPermission(java.lang.String,%20android.ne
%20int))
or any other mechanism.

(/reference/android/content/ContextWrapper#revokeUriPermission(java.lang.String,
%20android.net.Uri,%20int))
(/reference/java/lang/String) (/reference/android/net/U

Remove permissions to access a pa�icular content provider Uri that were previously adde
with

60 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context#grantUriPermission(java.lang.String,%20android.ne
%20int))
for a speci�c target package.

(/reference/android/content/ContextWrapper#sendBroadcast(android.content.Intent,
%20java.lang.String,%20android.os.Bundle))
(/reference/android/content/Intent) (/reference/java/lang/Str
(/reference/android/os/Bundle)

Broadcast the given intent to all interested BroadcastReceivers, allowing an optional requ
permission to be enforced.

(/reference/android/content/ContextWrapper#sendBroadcast(android.content.Intent,
%20java.lang.String))
(/reference/android/content/Intent) (/reference/java/lang/Str

Broadcast the given intent to all interested BroadcastReceivers, allowing an optional requ
permission to be enforced.

(/reference/android/content/ContextWrapper#sendBroadcast(android.content.Intent)
(/reference/android/content/Intent)

Broadcast the given intent to all interested BroadcastReceivers.

(/reference/android/content/ContextWrapper#sendBroadcastAsUser(android.content.Int
%20android.os.UserHandle))
(/reference/android/content/Intent)
(/reference/android/os/UserHandle)

61 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Version of
(/reference/android/content/Context#sendBroadcast(android.content.Intent)
to specify the user the broadcast will be sent to.

(/reference/android/content/ContextWrapper#sendBroadcastAsUser(android.content.Int
%20android.os.UserHandle,%20java.lang.String))
(/reference/android/content/Intent)
(/reference/android/os/UserHandle) (/reference/java/lang/String

Version of
(/reference/android/content/Context#sendBroadcast(android.content.Intent,
%20java.lang.String))
that allows you to specify the user the broadcast will be sent to.

(/reference/android/content/ContextWrapper#sendOrderedBroadcast(android.content.In
%20java.lang.String,%20java.lang.String,%20android.content.BroadcastReceiver,
%20android.os.Handler,%20int,%20java.lang.String,%20android.os.Bundle))
(/reference/android/content/Intent) (/reference/java/lang/Str
(/reference/java/lang/String)
(/reference/android/content/BroadcastReceiver)
(/reference/android/os/Handler)
(/reference/java/lang/String) (/reference/android/os/Bundle

Version of

(/reference/android/content/Context#sendOrderedBroadcast(android.content.Intent,
%20java.lang.String,%20android.content.BroadcastReceiver,%20android.os.Handler,%20
%20java.lang.String,%20android.os.Bundle))

62 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

that allows you to specify the App Op to enforce restrictions on which receivers the
broadcast will be sent to.

(/reference/android/content/ContextWrapper#sendOrderedBroadcast(android.content.In
%20int,%20java.lang.String,%20java.lang.String,%20android.content.BroadcastReceiver,
%20android.os.Handler,%20java.lang.String,%20android.os.Bundle,%20android.os.Bundl
(/reference/android/content/Intent)
(/reference/java/lang/String) (/reference/java/lang/St
(/reference/android/content/BroadcastReceive
(/reference/android/os/Handler)
(/reference/java/lang/String) (/reference/android/os/Bundle
(/reference/android/os/Bundle)

(/reference/android/content/ContextWrapper#sendOrderedBroadcast(android.content.In
%20java.lang.String,%20android.content.BroadcastReceiver,%20android.os.Handler,%20
%20java.lang.String,%20android.os.Bundle))
(/reference/android/content/Intent) (/reference/java/lang/Str

(/reference/android/content/BroadcastReceiver)
(/reference/android/os/Handler)
(/reference/java/lang/String) (/reference/android/os/Bundle

Version of
(/reference/android/content/Context#sendBroadcast(android.content.Intent)
to receive data back from the broadcast.

(/reference/android/content/ContextWrapper#sendOrderedBroadcast(android.content.In
%20java.lang.String,%20android.os.Bundle))

63 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Intent) (/reference/java/lang/Str
(/reference/android/os/Bundle)

Broadcast the given intent to all interested BroadcastReceivers, delivering them one at a
to allow more preferred receivers to consume the broadcast before it is delivered to less
preferred receivers.

(/reference/android/content/ContextWrapper#sendOrderedBroadcast(android.content.In
%20java.lang.String,%20android.os.Bundle,%20android.content.BroadcastReceiver,
%20android.os.Handler,%20int,%20java.lang.String,%20android.os.Bundle))
(/reference/android/content/Intent) (/reference/java/lang/Str
(/reference/android/os/Bundle)
(/reference/android/content/BroadcastReceiver)
(/reference/android/os/Handler)
(/reference/java/lang/String) (/reference/android/os/Bundle

Version of
(/reference/android/content/Context#sendBroadcast(android.content.Intent)
to receive data back from the broadcast.

(/reference/android/content/ContextWrapper#sendOrderedBroadcast(android.content.In
%20java.lang.String))
(/reference/android/content/Intent) (/reference/java/lang/Str

Broadcast the given intent to all interested BroadcastReceivers, delivering them one at a
to allow more preferred receivers to consume the broadcast before it is delivered to less
preferred receivers.

64 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/
ContextWrapper#sendOrderedBroadcastAsUser(android.content.Intent,
%20android.os.UserHandle,%20java.lang.String,%20android.content.BroadcastReceiver,
%20android.os.Handler,%20int,%20java.lang.String,%20android.os.Bundle))
(/reference/android/content/Intent)
(/reference/android/os/UserHandle) (/reference/java/lang/String

(/reference/android/content/BroadcastReceiver)
(/reference/android/os/Handler)
(/reference/java/lang/String) (/reference/android/os/Bundle

Version of

(/reference/android/content/Context#sendOrderedBroadcast(android.content.Intent,
%20java.lang.String,%20android.content.BroadcastReceiver,%20android.os.Handler,%20
%20java.lang.String,%20android.os.Bundle))
that allows you to specify the user the broadcast will be sent to.

(/reference/android/content/ContextWrapper#sendStickyBroadcast(android.content.Inte
(/reference/android/content/Intent)

This method is deprecated. Sticky broadcasts should not be used. They provide no secur
(anyone can access them), no protection (anyone can modify them), and many other
problems. The recommended pa�ern is to use a non-sticky broadcast to repo� that
something has changed, with another mechanism for apps to retrieve the current value
whenever desired.

(/reference/android/content/ContextWrapper#sendStickyBroadcast(android.content.Inte
%20android.os.Bundle))
(/reference/android/content/Intent)

65 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/os/Bundle)

This method is deprecated. Sticky broadcasts should not be used. They provide no secur
(anyone can access them), no protection (anyone can modify them), and many other
problems. The recommended pa�ern is to use a non-sticky broadcast to repo� that
something has changed, with another mechanism for apps to retrieve the current value
whenever desired.

(/reference/android/content/
ContextWrapper#sendStickyBroadcastAsUser(android.content.Intent,
%20android.os.UserHandle))
(/reference/android/content/Intent)
(/reference/android/os/UserHandle)

This method is deprecated. Sticky broadcasts should not be used. They provide no secur
(anyone can access them), no protection (anyone can modify them), and many other
problems. The recommended pa�ern is to use a non-sticky broadcast to repo� that
something has changed, with another mechanism for apps to retrieve the current value
whenever desired.

(/reference/android/content/
ContextWrapper#sendStickyOrderedBroadcast(android.content.Intent,
%20android.content.BroadcastReceiver,%20android.os.Handler,%20int,%20java.lang.Stri
%20android.os.Bundle))
(/reference/android/content/Intent)
(/reference/android/content/BroadcastReceiver)
(/reference/android/os/Handler)
(/reference/java/lang/String) (/reference/android/os/Bundle

This method is deprecated. Sticky broadcasts should not be used. They provide no secur
(anyone can access them), no protection (anyone can modify them), and many other

66 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

problems. The recommended pa�ern is to use a non-sticky broadcast to repo� that


something has changed, with another mechanism for apps to retrieve the current value
whenever desired.

(/reference/android/content/
ContextWrapper#sendStickyOrderedBroadcastAsUser(android.content.Intent,
%20android.os.UserHandle,%20android.content.BroadcastReceiver,%20android.os.Hand
%20int,%20java.lang.String,%20android.os.Bundle))
(/reference/android/content/Intent)
(/reference/android/os/UserHandle)
(/reference/android/content/BroadcastReceiver)
(/reference/android/os/Handler)
(/reference/java/lang/String) (/reference/android/os/Bundle

This method is deprecated. Sticky broadcasts should not be used. They provide no secur
(anyone can access them), no protection (anyone can modify them), and many other
problems. The recommended pa�ern is to use a non-sticky broadcast to repo� that
something has changed, with another mechanism for apps to retrieve the current value
whenever desired.

(/reference/android/content/ContextWrapper#setTheme(int))

Set the base theme for this context.

(/reference/android/content/ContextWrapper#setWallpaper(android.graphics.Bitmap)
(/reference/android/graphics/Bitmap)

This method is deprecated. Use


(/reference/android/app/WallpaperManager#setBitmap(android.graphics.Bitmap)

This method requires the caller to hold the permission

67 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/Manifest.permission#SET_WALLPAPER).

(/reference/android/content/ContextWrapper#setWallpaper(java.io.InputStream)
(/reference/java/io/InputStream)

This method is deprecated. Use


(/reference/android/app/WallpaperManager#setStream(java.io.InputStream))

This method requires the caller to hold the permission

(/reference/android/Manifest.permission#SET_WALLPAPER).

(/reference/android/content/ContextWrapper#sta�Activities(android.content.Intent[],
%20android.os.Bundle))
(/reference/android/content/Intent)
(/reference/android/os/Bundle)

Launch multiple new activities.

(/reference/android/content/ContextWrapper#sta�Activities(android.content.Intent[])
(/reference/android/content/Intent)

Same as
(/reference/android/content/Context#sta�Activities(android.content.Intent[],
%20android.os.Bundle))
with no options speci�ed.

(/reference/android/content/ContextWrapper#sta�Activity(android.content.Intent)

68 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Intent)

Same as
(/reference/android/content/Context#sta�Activity(android.content.Intent,
%20android.os.Bundle))
with no options speci�ed.

(/reference/android/content/ContextWrapper#sta�Activity(android.content.Intent,
%20android.os.Bundle))
(/reference/android/content/Intent)
(/reference/android/os/Bundle)

Launch a new activity.

(/reference/android/content/ComponentName)
(/reference/android/content/
ContextWrapper#sta�ForegroundService(android.content.Intent))
(/reference/android/content/Intent)

Similar to
(/reference/android/content/Context#sta�Service(android.content.Intent)), but with an
implicit promise that the Service will call

(/reference/android/app/Service#sta�Foreground(int,%20android.app.Noti�cation)
begins running.

(/reference/android/content/
ContextWrapper#sta�Instrumentation(android.content.ComponentName,
%20java.lang.String,%20android.os.Bundle))
(/reference/android/content/ComponentName)
(/reference/java/lang/String) (/reference/android/os/Bundle

69 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Sta� executing an (/reference/android/app/Instrumentation

(/reference/android/content/
ContextWrapper#sta�IntentSender(android.content.IntentSender,%20android.content.In
%20int,%20int,%20int))
(/reference/android/content/IntentSender)
(/reference/android/content/Intent)

Same as

(/reference/android/content/Context#sta�IntentSender(android.content.IntentSender,
%20android.content.Intent,%20int,%20int,%20int,%20android.os.Bundle))
with no options speci�ed.

(/reference/android/content/
ContextWrapper#sta�IntentSender(android.content.IntentSender,%20android.content.In
%20int,%20int,%20int,%20android.os.Bundle))
(/reference/android/content/IntentSender)
(/reference/android/content/Intent)
(/reference/android/os/Bundle)

Like
(/reference/android/content/Context#sta�Activity(android.content.Intent,
%20android.os.Bundle))
, but taking a IntentSender to sta�.

(/reference/android/content/ComponentName)

(/reference/android/content/ContextWrapper#sta�Service(android.content.Intent)
(/reference/android/content/Intent)

70 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Request that a given application service be sta�ed.

(/reference/android/content/ContextWrapper#stopService(android.content.Intent)
(/reference/android/content/Intent)

Request that a given application service be stopped.

(/reference/android/content/
ContextWrapper#unbindService(android.content.ServiceConnection))
(/reference/android/content/ServiceConnection)

Disconnect from an application service.

(/reference/android/content/
ContextWrapper#unregisterComponentCallbacks(android.content.ComponentCallbacks)
(/reference/android/content/ComponentCallbacks)

Remove a (/reference/android/content/ComponentCallbacks
that was previously registered with

(/reference/android/content/
ContextWrapper#registerComponentCallbacks(android.content.ComponentCallbacks)
.

(/reference/android/content/
ContextWrapper#unregisterDeviceIdChangeListener(java.util.function.IntConsumer)
(/reference/java/util/function/IntConsumer)

71 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Removes a device ID changed listener from the Context.

(/reference/android/content/
ContextWrapper#unregisterReceiver(android.content.BroadcastReceiver))
(/reference/android/content/BroadcastReceiver)

Unregister a previously registered BroadcastReceiver.

(/reference/android/content/
ContextWrapper#updateServiceGroup(android.content.ServiceConnection,%20int,%20in
(/reference/android/content/ServiceConnection)

For a service previously bound with

(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
or a related method, change how the system manages that service's process in relation to
other processes.

From class (/reference/android/content/Context)

(/reference/android/content/Context#bindIsolatedService(android.content.In
%20int,%20java.lang.String,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
(/reference/android/content/Intent)
(/reference/java/lang/String)
(/reference/java/util/concurrent/Executor)
(/reference/android/content/ServiceConnection)

72 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Variation of

(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Execu
%20android.content.ServiceConnection))
that, in the speci�c case of isolated services, allows the caller to generate
multiple instances of a service from a single component declaration.

(/reference/android/content/Context#bindIsolatedService(android.content.In
%20android.content.Context.BindServiceFlags,%20java.lang.String,
%20java.util.concurrent.Executor,%20android.content.ServiceConnection)
(/reference/android/content/Intent)
(/reference/android/content/Context.BindServiceFlags
(/reference/java/lang/String)
(/reference/java/util/concurrent/Executor)
(/reference/android/content/ServiceConnection)

See

(/reference/android/content/Context#bindIsolatedService(android.content.In
%20int,%20java.lang.String,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
Call
(/reference/android/content/Context.BindServiceFlags#of(long)) to obtain a
BindServiceFlags object.

(/reference/android/content/Context#bindService(android.content.Intent,%20
%20java.util.concurrent.Executor,%20android.content.ServiceConnection)
(/reference/android/content/Intent)
(/reference/java/util/concurrent/Executor)

73 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/ServiceConnection

Same as
(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.ServiceConnection,%20int))
with executor to control ServiceConnection callbacks.

(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.ServiceConnection,
%20android.content.Context.BindServiceFlags))
(/reference/android/content/Intent)
(/reference/android/content/ServiceConnection)
(/reference/android/content/Context.BindServiceFlags

See

(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.ServiceConnection,%20int))
Call
(/reference/android/content/Context.BindServiceFlags#of(long)) to obtain a
BindServiceFlags object.

(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.ServiceConnection,%20int))
(/reference/android/content/Intent)
(/reference/android/content/ServiceConnection)

Connects to an application service, creating it if needed.

74 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Execu
%20android.content.ServiceConnection))
(/reference/android/content/Intent)
(/reference/android/content/Context.BindServiceFlags
(/reference/java/util/concurrent/Executor)
(/reference/android/content/ServiceConnection

See

(/reference/android/content/Context#bindService(android.content.Intent,%20
%20java.util.concurrent.Executor,%20android.content.ServiceConnection)
Call
(/reference/android/content/Context.BindServiceFlags#of(long)) to obtain a
BindServiceFlags object.

(/reference/android/content/Context#bindServiceAsUser(android.content.Int
%20android.content.ServiceConnection,%20int,%20android.os.UserHandle)
(/reference/android/content/Intent)
(/reference/android/content/ServiceConnection)
(/reference/android/os/UserHandle)

Binds to a service in the given in the same manner as

(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Execu
%20android.content.ServiceConnection))
.

75 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context#bindServiceAsUser(android.content.Int
%20android.content.ServiceConnection,
%20android.content.Context.BindServiceFlags,%20android.os.UserHandle)
(/reference/android/content/Intent)
(/reference/android/content/ServiceConnection)
(/reference/android/content/Context.BindServiceFlags
(/reference/android/os/UserHandle)

See

(/reference/android/content/Context#bindServiceAsUser(android.content.Int
%20android.content.ServiceConnection,%20int,%20android.os.UserHandle)
Call
(/reference/android/content/Context.BindServiceFlags#of(long)) to obtain a
BindServiceFlags object.

(/reference/android/content/
Context#checkCallingOrSelfPermission(java.lang.String))
(/reference/java/lang/String)

Determine whether the calling process of an IPC or you have been granted a
pa�icular permission.

(/reference/android/content/
Context#checkCallingOrSelfUriPermission(android.net.Uri,%20int)
(/reference/android/net/Uri)

Determine whether the calling process of an IPC or you has been granted
permission to access a speci�c URI.

76 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/
Context#checkCallingOrSelfUriPermissions(java.util.List<android.net.Uri>,
%20int))
(/reference/java/util/List) (/reference/android/net/Uri)

Determine whether the calling process of an IPC or you has been granted
permission to access a list of URIs.

(/reference/android/content/Context#checkCallingPermission(java.lang.String
(/reference/java/lang/String)

Determine whether the calling process of an IPC you are handling has been
granted a pa�icular permission.

(/reference/android/content/Context#checkCallingUriPermission(android.net
%20int))
(/reference/android/net/Uri)

Determine whether the calling process and user ID has been granted permiss
to access a speci�c URI.

(/reference/android/content/
Context#checkCallingUriPermissions(java.util.List<android.net.Uri>,%20int)
(/reference/java/util/List) (/reference/android/net/Uri)

Determine whether the calling process and user ID has been granted permiss
to access a list of URIs.

77 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context#checkPermission(java.lang.String,%20i
%20int))
(/reference/java/lang/String)

Determine whether the given permission is allowed for a pa�icular process an


user ID running in the system.

(/reference/android/content/Context#checkSelfPermission(java.lang.String)
(/reference/java/lang/String)

Determine whether you have been granted a pa�icular permission.

(/reference/android/content/Context#checkUriPermission(android.net.Uri,
%20java.lang.String,%20java.lang.String,%20int,%20int,%20int))
(/reference/android/net/Uri) (/reference/java/lang/String
(/reference/java/lang/String)

Check both a Uri and normal permission.

(/reference/android/content/Context#checkUriPermission(android.net.Uri,%2
%20int,%20int))
(/reference/android/net/Uri)

Determine whether a pa�icular process and user ID has been granted permis
to access a speci�c URI.

78 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/
Context#checkUriPermissions(java.util.List<android.net.Uri>,%20int,%20int,
%20int))
(/reference/java/util/List) (/reference/android/net/Uri)

Determine whether a pa�icular process and user ID has been granted permis
to access a list of URIs.

(/reference/android/content/Context#clearWallpaper()

This method was deprecated in API level 15. Use


(/reference/android/app/WallpaperManager#clear()) instead.

This method requires the caller to hold the permission

(/reference/android/Manifest.permission#SET_WALLPAPER).

(/reference/android/content/Context)
(/reference/android/content/Context#createA�ributionContext(java.lang.Strin
(/reference/java/lang/String)

Return a new Context object for the current Context but a�ribute to a di�eren
tag.

(/reference/android/content/Context)
(/reference/android/content/
Context#createCon�gurationContext(android.content.res.Con�guration)
(/reference/android/content/res/Con�guration)

Return a new Context object for the current Context but whose resources are

79 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

adjusted to match the given Con�guration.

(/reference/android/content/Context)
(/reference/android/content/
Context#createContext(android.content.ContextParams))
(/reference/android/content/ContextParams)

Creates a context with speci�c prope�ies and behaviors.

(/reference/android/content/Context)

(/reference/android/content/Context#createContextForSplit(java.lang.String)
(/reference/java/lang/String)

Return a new Context object for the given split name.

(/reference/android/content/Context)
(/reference/android/content/Context#createDeviceContext(int))

Returns a new object from the current context but with device
association given by the .

(/reference/android/content/Context)
(/reference/android/content/Context#createDeviceProtectedStorageContext

Return a new Context object for the current Context but whose storage APIs a
backed by device-protected storage.

(/reference/android/content/Context)
(/reference/android/content/
Context#createDisplayContext(android.view.Display))
(/reference/android/view/Display)

80 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Returns a new object from the current context but with resources
adjusted to match the metrics of .

(/reference/android/content/Context)

(/reference/android/content/Context#createPackageContext(java.lang.String
%20int))
(/reference/java/lang/String)

Return a new Context object for the given application name.

(/reference/android/content/Context)
(/reference/android/content/Context#createWindowContext(int,
%20android.os.Bundle))
(/reference/android/os/Bundle)

Creates a Context for a non-activity window.

(/reference/android/content/Context)
(/reference/android/content/Context#createWindowContext(android.view.Dis
%20int,%20android.os.Bundle))
(/reference/android/view/Display)
(/reference/android/os/Bundle)

Creates a for a non- (/reference/android/app/Activity


on the given (/reference/android/view/Display).

(/reference/java/lang/String)
(/reference/android/content/Context#databaseList()

Returns an array of strings naming the private databases associated with this
Context's application package.

81 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context#deleteDatabase(java.lang.String)
(/reference/java/lang/String)

Delete an existing private SQLiteDatabase associated with this Context's


application package.

(/reference/android/content/Context#deleteFile(java.lang.String
(/reference/java/lang/String)

Delete the given private �le associated with this Context's application packag

(/reference/android/content/Context#deleteSharedPreferences(java.lang.Stri
(/reference/java/lang/String)

Delete an existing shared preferences �le.

(/reference/android/content/
Context#enforceCallingOrSelfPermission(java.lang.String,%20java.lang.String
(/reference/java/lang/String)
(/reference/java/lang/String)

If neither you nor the calling process of an IPC you are handling has been gra
a pa�icular permission, throw a
(/reference/java/lang/SecurityException).

(/reference/android/content/
Context#enforceCallingOrSelfUriPermission(android.net.Uri,%20int,
%20java.lang.String))
(/reference/android/net/Uri)
(/reference/java/lang/String)

82 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

If the calling process of an IPC or you has not been granted permission to acc
a speci�c URI, throw
(/reference/java/lang/SecurityException).

(/reference/android/content/Context#enforceCallingPermission(java.lang.Stri
%20java.lang.String))
(/reference/java/lang/String)
(/reference/java/lang/String)

If the calling process of an IPC you are handling has not been granted a pa�ic
permission, throw a
(/reference/java/lang/SecurityException).

(/reference/android/content/
Context#enforceCallingUriPermission(android.net.Uri,%20int,
%20java.lang.String))
(/reference/android/net/Uri)
(/reference/java/lang/String)

If the calling process and user ID has not been granted permission to access
speci�c URI, throw
(/reference/java/lang/SecurityException).

(/reference/android/content/Context#enforcePermission(java.lang.String,%20
%20int,%20java.lang.String))
(/reference/java/lang/String)
(/reference/java/lang/String)

If the given permission is not allowed for a pa�icular process and user ID run
in the system, throw a

83 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/lang/SecurityException).

(/reference/android/content/Context#enforceUriPermission(android.net.Uri,
%20java.lang.String,%20java.lang.String,%20int,%20int,%20int,
%20java.lang.String))
(/reference/android/net/Uri) (/reference/java/lang/String
(/reference/java/lang/String)
(/reference/java/lang/Stri

Enforce both a Uri and normal permission.

(/reference/android/content/Context#enforceUriPermission(android.net.Uri,
%20int,%20int,%20int,%20java.lang.String))
(/reference/android/net/Uri)
(/reference/java/lang/String)

If a pa�icular process and user ID has not been granted permission to access
speci�c URI, throw
(/reference/java/lang/SecurityException).

(/reference/java/lang/String)
(/reference/android/content/Context#�leList())

Returns an array of strings naming the private �les associated with this Conte
application package.

(/reference/android/content/Context)

(/reference/android/content/Context#getApplicationContext())

Return the context of the single, global Application object of the current proc

84 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/pm/ApplicationInfo)
(/reference/android/content/Context#getApplicationInfo())

Return the full application info for this context's package.

(/reference/android/content/res/AssetManager)
(/reference/android/content/Context#getAssets())

Returns an AssetManager instance for the application's package.

(/reference/android/content/A�ributionSource)

(/reference/android/content/Context#getA�ributionSource())

(/reference/java/lang/String)
(/reference/android/content/Context#getA�ributionTag

A�ribution can be used in complex apps to logically separate pa�s of the app

(/reference/java/io/File)
(/reference/android/content/Context#getCacheDir()

Returns the absolute path to the application speci�c cache directory on the
�lesystem.

(/reference/java/lang/ClassLoader)
(/reference/android/content/Context#getClassLoader()

Return a class loader you can use to retrieve classes in this package.

(/reference/java/io/File)
(/reference/android/content/Context#getCodeCacheDir()

Returns the absolute path to the application speci�c cache directory on the
�lesystem designed for storing cached code.

85 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context#getColor(int))

Returns a color associated with a pa�icular resource ID and styled for the cu
theme.

(/reference/android/content/res/ColorStateList)
(/reference/android/content/Context#getColorStateList(int))

Returns a color state list associated with a pa�icular resource ID and styled f
the current theme.

(/reference/android/content/ContentResolver)

(/reference/android/content/Context#getContentResolver())

Return a ContentResolver instance for your application's package.

(/reference/java/io/File)
(/reference/android/content/Context#getDataDir())

Returns the absolute path to the directory on the �lesystem where all private
belonging to this app are stored.

(/reference/java/io/File)
(/reference/android/content/Context#getDatabasePath(java.lang.String)
(/reference/java/lang/String)

Returns the absolute path on the �lesystem where a database created with

(/reference/android/content/Context#openOrCreateDatabase(java.lang.Strin
%20int,%20android.database.sqlite.SQLiteDatabase.CursorFactory)
is stored.

(/reference/android/content/Context#getDeviceId()

86 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Gets the device ID this context is associated with.

(/reference/java/io/File)
(/reference/android/content/Context#getDir(java.lang.String,%20int)
(/reference/java/lang/String)

Retrieve, creating if needed, a new directory in which the application can plac
own custom data �les.

(/reference/android/view/Display)
(/reference/android/content/Context#getDisplay())

Get the display this context is associated with.

(/reference/android/graphics/drawable/Drawable)
(/reference/android/content/Context#getDrawable(int)

Returns a drawable object associated with a pa�icular resource ID and styled


the current theme.

(/reference/java/io/File)
(/reference/android/content/Context#getExternalCacheDir())

Returns absolute path to application-speci�c directory on the primary shared


external storage device where the application can place cache �les it owns.

(/reference/java/io/File)
(/reference/android/content/Context#getExternalCacheDirs())

Returns absolute paths to application-speci�c directories on all shared/extern


storage devices where the application can place cache �les it owns.

(/reference/java/io/File)
(/reference/android/content/Context#getExternalFilesDir(java.lang.String)

87 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/java/lang/String)

Returns the absolute path to the directory on the primary shared/external sto
device where the application can place persistent �les it owns.

(/reference/java/io/File)
(/reference/android/content/Context#getExternalFilesDirs(java.lang.String)
(/reference/java/lang/String)

Returns absolute paths to application-speci�c directories on all shared/extern


storage devices where the application can place persistent �les it owns.

(/reference/java/io/File)
(/reference/android/content/Context#getExternalMediaDirs())

This method was deprecated in API level 30. These directories still exist and a
scanned, but developers are encouraged to migrate to inse�ing content into
(/reference/android/provider/MediaStore) collection directly, as
app can contribute new media to
(/reference/android/provider/MediaStore) with no permissions required, sta�
in (/reference/android/os/Build.VERSION_CODES#

(/reference/java/io/File)

(/reference/android/content/Context#getFileStreamPath(java.lang.String)
(/reference/java/lang/String)

Returns the absolute path on the �lesystem where a �le created with

(/reference/android/content/Context#openFileOutput(java.lang.String,%20in
stored.

(/reference/java/io/File)
(/reference/android/content/Context#getFilesDir())

88 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Returns the absolute path to the directory on the �lesystem where �les creat
with
(/reference/android/content/Context#openFileOutput(java.lang.String,%20in
are stored.

(/reference/java/util/concurrent/Executor)
(/reference/android/content/Context#getMainExecutor()

Return an (/reference/java/util/concurrent/Executor) that will run


enqueued tasks on the main thread associated with this context.

(/reference/android/os/Looper)
(/reference/android/content/Context#getMainLooper()

Return the Looper for the main thread of the current process.

(/reference/java/io/File)
(/reference/android/content/Context#getNoBackupFilesDir())

Returns the absolute path to the directory on the �lesystem similar to


(/reference/android/content/Context#getFilesDir()

(/reference/java/io/File)
(/reference/android/content/Context#getObbDir())

Return the primary shared/external storage directory where this application's


�les (if there are any) can be found.

(/reference/java/io/File)
(/reference/android/content/Context#getObbDirs())

Returns absolute paths to application-speci�c directories on all shared/extern


storage devices where the application's OBB �les (if there are any) can be fou

(/reference/java/lang/String)

89 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context#getOpPackageName())

Return the package name that should be used for


(/reference/android/app/AppOpsManager) calls from this context, so that app
ops manager's uid veri�cation will work with the name.

(/reference/java/lang/String)

(/reference/android/content/Context#getPackageCodePath())

Return the full path to this context's primary Android package.

(/reference/android/content/pm/PackageManager)
(/reference/android/content/Context#getPackageManager())

Return PackageManager instance to �nd global package information.

(/reference/java/lang/String)
(/reference/android/content/Context#getPackageName()

Return the name of this application's package.

(/reference/java/lang/String)
(/reference/android/content/Context#getPackageResourcePath()

Return the full path to this context's primary Android package.

(/reference/android/content/ContextParams)
(/reference/android/content/Context#getParams())

Return the set of parameters which this Context was created with, if it was
created via
(/reference/android/content/
Context#createContext(android.content.ContextParams))
.

90 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/res/Resources)
(/reference/android/content/Context#getResources()

Returns a Resources instance for the application's package.

(/reference/android/content/SharedPreferences)
(/reference/android/content/Context#getSharedPreferences(java.lang.String
%20int))
(/reference/java/lang/String)

Retrieve and hold the contents of the preferences �le 'name', returning a
SharedPreferences through which you can retrieve and modify its values.

(/reference/java/lang/String)
(/reference/android/content/Context#getString(int))

Returns a localized string from the application's package's default string table

(/reference/java/lang/String)
(/reference/android/content/Context#getString(int,%20java.lang.Object[])
(/reference/java/lang/Object)

Returns a localized forma�ed string from the application's package's default


string table, substituting the format arguments as de�ned in
(/reference/java/util/Forma�er) and
(/reference/java/lang/String#format(java.lang.String,%20java.lang.Object[])

(/reference/android/content/Context#getSystemService(java.lang.Class<T>)
(/reference/java/lang/Class)

Return the handle to a system-level service by class.

(/reference/java/lang/Object)

91 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context#getSystemService(java.lang.String)
(/reference/java/lang/String)

Return the handle to a system-level service by name.

(/reference/java/lang/String)
(/reference/android/content/Context#getSystemServiceName(java.lang.Class
>))
(/reference/java/lang/Class)

Gets the name of the system-level service that is represented by the speci�e
class.

(/reference/java/lang/CharSequence)
(/reference/android/content/Context#getText(int))

Return a localized, styled CharSequence from the application's package's def


string table.

(/reference/android/content/res/Resources.Theme)
(/reference/android/content/Context#getTheme())

Return the Theme object associated with this Context.

(/reference/android/graphics/drawable/Drawable)
(/reference/android/content/Context#getWallpaper()

This method was deprecated in API level 15. Use


(/reference/android/app/WallpaperManager#getDrawable()) instead.

(/reference/android/content/Context#getWallpaperDesiredMinimumHeight()

This method was deprecated in API level 15. Use

(/reference/android/app/WallpaperManager#getDesiredMinimumHeight()

92 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

instead.

(/reference/android/content/Context#getWallpaperDesiredMinimumWidth()

This method was deprecated in API level 15. Use

(/reference/android/app/WallpaperManager#getDesiredMinimumWidth()
instead.

(/reference/android/content/Context#grantUriPermission(java.lang.String,
%20android.net.Uri,%20int))
(/reference/java/lang/String)
(/reference/android/net/Uri)

Grant permission to access a speci�c Uri to another package, regardless of


whether that package has general permission to access the Uri's content
provider.

(/reference/android/content/Context#isDeviceProtectedStorage()

Indicates if the storage APIs of this Context are backed by device-protected


storage.

(/reference/android/content/Context#isRestricted()

Indicates whether this Context is restricted.

(/reference/android/content/Context#isUiContext()

Returns if the context is a UI context which can access UI components s

93 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

as (/reference/android/view/WindowManager),
(/reference/android/view/LayoutIn�ater) or
(/reference/android/app/WallpaperManager

(/reference/android/content/
Context#moveDatabaseFrom(android.content.Context,%20java.lang.String)
(/reference/android/content/Context)
(/reference/java/lang/String)

Move an existing database �le from the given source storage context to this
context.

(/reference/android/content/
Context#moveSharedPreferencesFrom(android.content.Context,
%20java.lang.String))
(/reference/android/content/Context)
(/reference/java/lang/String)

Move an existing shared preferences �le from the given source storage conte
this context.

(/reference/android/content/res/TypedArray)
(/reference/android/content/
Context#obtainStyledA�ributes(android.util.A�ributeSet,%20int[])
(/reference/android/util/A�ributeSet)

Retrieve styled a�ribute information in this Context's theme.

(/reference/android/content/res/TypedArray)

94 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/
Context#obtainStyledA�ributes(android.util.A�ributeSet,%20int[],%20int,
%20int))
(/reference/android/util/A�ributeSet)

Retrieve styled a�ribute information in this Context's theme.

(/reference/android/content/res/TypedArray)

(/reference/android/content/Context#obtainStyledA�ributes(int,%20int[])

Retrieve styled a�ribute information in this Context's theme.

(/reference/android/content/res/TypedArray)
(/reference/android/content/Context#obtainStyledA�ributes(int[])

Retrieve styled a�ribute information in this Context's theme.

(/reference/java/io/FileInputStream)

(/reference/android/content/Context#openFileInput(java.lang.String)
(/reference/java/lang/String)

Open a private �le associated with this Context's application package for rea

(/reference/java/io/FileOutputStream)
(/reference/android/content/Context#openFileOutput(java.lang.String,%20in
(/reference/java/lang/String)

Open a private �le associated with this Context's application package for writ

(/reference/android/database/sqlite/SQLiteDatabase)

95 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context#openOrCreateDatabase(java.lang.Strin
%20int,%20android.database.sqlite.SQLiteDatabase.CursorFactory,
%20android.database.DatabaseErrorHandler))
(/reference/java/lang/String)

(/reference/android/database/sqlite/SQLiteDatabase.CursorFactory
(/reference/android/database/DatabaseErrorHand

Open a new private SQLiteDatabase associated with this Context's applicatio


package.

(/reference/android/database/sqlite/SQLiteDatabase)
(/reference/android/content/Context#openOrCreateDatabase(java.lang.Strin
%20int,%20android.database.sqlite.SQLiteDatabase.CursorFactory)
(/reference/java/lang/String)

(/reference/android/database/sqlite/SQLiteDatabase.CursorFactory

Open a new private SQLiteDatabase associated with this Context's applicatio


package.

(/reference/android/graphics/drawable/Drawable)
(/reference/android/content/Context#peekWallpaper()

This method was deprecated in API level 15. Use


(/reference/android/app/WallpaperManager#peekDrawable()) instead.

(/reference/android/content/
Context#registerComponentCallbacks(android.content.ComponentCallbacks
(/reference/android/content/ComponentCallbacks

Add a new

96 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/ComponentCallbacks) to the base application of


Context, which will be called at the same times as the ComponentCallbacks
methods of activities and other components are called.

(/reference/android/content/
Context#registerDeviceIdChangeListener(java.util.concurrent.Executor,
%20java.util.function.IntConsumer))
(/reference/java/util/concurrent/Executor)
(/reference/java/util/function/IntConsumer)

Adds a new device ID changed listener to the , which will be called w


the device association is changed by the system.

(/reference/android/content/Intent)
(/reference/android/content/
Context#registerReceiver(android.content.BroadcastReceiver,
%20android.content.IntentFilter))
(/reference/android/content/BroadcastReceiver
(/reference/android/content/IntentFilter

Register a BroadcastReceiver to be run in the main activity thread.

(/reference/android/content/Intent)
(/reference/android/content/
Context#registerReceiver(android.content.BroadcastReceiver,
%20android.content.IntentFilter,%20int))
(/reference/android/content/BroadcastReceiver
(/reference/android/content/IntentFilter

Register to receive intent broadcasts, with the receiver optionally being expos
to Instant Apps.

97 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Intent)
(/reference/android/content/
Context#registerReceiver(android.content.BroadcastReceiver,
%20android.content.IntentFilter,%20java.lang.String,%20android.os.Handler,
%20int))
(/reference/android/content/BroadcastReceiver
(/reference/android/content/IntentFilter
(/reference/java/lang/String)
(/reference/android/os/Handler)

Register to receive intent broadcasts, to run in the context of scheduler

(/reference/android/content/Intent)
(/reference/android/content/
Context#registerReceiver(android.content.BroadcastReceiver,
%20android.content.IntentFilter,%20java.lang.String,%20android.os.Handler)
(/reference/android/content/BroadcastReceiver
(/reference/android/content/IntentFilter
(/reference/java/lang/String)
(/reference/android/os/Handler)

Register to receive intent broadcasts, to run in the context of scheduler

(/reference/android/content/
Context#removeStickyBroadcast(android.content.Intent))
(/reference/android/content/Intent)

This method was deprecated in API level 21. Sticky broadcasts should not be
used. They provide no security (anyone can access them), no protection (any
can modify them), and many other problems. The recommended pa�ern is to
a non-sticky broadcast to repo� that something has changed, with another
mechanism for apps to retrieve the current value whenever desired.

98 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/
Context#removeStickyBroadcastAsUser(android.content.Intent,
%20android.os.UserHandle))
(/reference/android/content/Intent)
(/reference/android/os/UserHandle)

This method was deprecated in API level 21. Sticky broadcasts should not be
used. They provide no security (anyone can access them), no protection (any
can modify them), and many other problems. The recommended pa�ern is to
a non-sticky broadcast to repo� that something has changed, with another
mechanism for apps to retrieve the current value whenever desired.

(/reference/android/content/
Context#revokeSelfPermissionOnKill(java.lang.String))
(/reference/java/lang/String)

Triggers the asynchronous revocation of a runtime permission.

(/reference/android/content/
Context#revokeSelfPermissionsOnKill(java.util.Collection<java.lang.String>)
(/reference/java/util/Collection)
(/reference/java/lang/String)

Triggers the revocation of one or more permissions for the calling package.

(/reference/android/content/Context#revokeUriPermission(android.net.Uri,
%20int))
(/reference/android/net/Uri)

99 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Remove all permissions to access a pa�icular content provider Uri that were
previously added with
(/reference/android/content/Context#grantUriPermission(java.lang.String,
%20android.net.Uri,%20int))
or any other mechanism.

(/reference/android/content/Context#revokeUriPermission(java.lang.String,
%20android.net.Uri,%20int))
(/reference/java/lang/String)
(/reference/android/net/Uri)

Remove permissions to access a pa�icular content provider Uri that were


previously added with
(/reference/android/content/Context#grantUriPermission(java.lang.String,
%20android.net.Uri,%20int))
for a speci�c target package.

(/reference/android/content/Context#sendBroadcast(android.content.Intent,
%20java.lang.String,%20android.os.Bundle))
(/reference/android/content/Intent)
(/reference/java/lang/String)
(/reference/android/os/Bundle)

Broadcast the given intent to all interested BroadcastReceivers, allowing an


optional required permission to be enforced.

(/reference/android/content/Context#sendBroadcast(android.content.Intent,
%20java.lang.String))
(/reference/android/content/Intent)
(/reference/java/lang/String)

100 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Broadcast the given intent to all interested BroadcastReceivers, allowing an


optional required permission to be enforced.

(/reference/android/content/Context#sendBroadcast(android.content.Intent)
(/reference/android/content/Intent)

Broadcast the given intent to all interested BroadcastReceivers.

(/reference/android/content/
Context#sendBroadcastAsUser(android.content.Intent,
%20android.os.UserHandle))
(/reference/android/content/Intent)
(/reference/android/os/UserHandle)

Version of
(/reference/android/content/Context#sendBroadcast(android.content.Intent)
that allows you to specify the user the broadcast will be sent to.

101 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/
Context#sendBroadcastAsUser(android.content.Intent,
%20android.os.UserHandle,%20java.lang.String))
(/reference/android/content/Intent)
(/reference/android/os/UserHandle) (/reference/java/lang/St

Version of

(/reference/android/content/Context#sendBroadcast(android.content.Intent,
%20java.lang.String))
that allows you to specify the user the broadcast will be sent to.

(/reference/android/content/
Context#sendBroadcastWithMultiplePermissions(android.content.Intent,
%20java.lang.String[]))
(/reference/android/content/Intent)
(/reference/java/lang/String)

Broadcast the given intent to all interested BroadcastReceivers, allowing an a


of required permissions to be enforced.

(/reference/android/content/
Context#sendOrderedBroadcast(android.content.Intent,%20java.lang.String,
%20java.lang.String,%20android.content.BroadcastReceiver,
%20android.os.Handler,%20int,%20java.lang.String,%20android.os.Bundle)
(/reference/android/content/Intent)
(/reference/java/lang/String)
(/reference/java/lang/String)
(/reference/android/content/BroadcastReceiver)

102 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/os/Handler)
(/reference/java/lang/String)
(/reference/android/os/Bundle)

Version of

(/reference/android/content/
Context#sendOrderedBroadcast(android.content.Intent,%20java.lang.String,
%20android.content.BroadcastReceiver,%20android.os.Handler,%20int,
%20java.lang.String,%20android.os.Bundle))
that allows you to specify the App Op to enforce restrictions on which receive
the broadcast will be sent to.

(/reference/android/content/
Context#sendOrderedBroadcast(android.content.Intent,%20java.lang.String,
%20android.content.BroadcastReceiver,%20android.os.Handler,%20int,
%20java.lang.String,%20android.os.Bundle))
(/reference/android/content/Intent)
(/reference/java/lang/String)
(/reference/android/content/BroadcastReceiver)
(/reference/android/os/Handler)
(/reference/java/lang/String)
(/reference/android/os/Bundle)

Version of
(/reference/android/content/Context#sendBroadcast(android.content.Intent)
that allows you to receive data back from the broadcast.

(/reference/android/content/
Context#sendOrderedBroadcast(android.content.Intent,%20java.lang.String,
%20android.os.Bundle))

103 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Intent)
(/reference/java/lang/String)
(/reference/android/os/Bundle)

Broadcast the given intent to all interested BroadcastReceivers, delivering the


one at a time to allow more preferred receivers to consume the broadcast be
it is delivered to less preferred receivers.

(/reference/android/content/
Context#sendOrderedBroadcast(android.content.Intent,%20java.lang.String,
%20android.os.Bundle,%20android.content.BroadcastReceiver,
%20android.os.Handler,%20int,%20java.lang.String,%20android.os.Bundle)
(/reference/android/content/Intent)
(/reference/java/lang/String)
(/reference/android/os/Bundle)
(/reference/android/content/BroadcastReceiver)
(/reference/android/os/Handler)
(/reference/java/lang/String)
(/reference/android/os/Bundle)

Version of
(/reference/android/content/Context#sendBroadcast(android.content.Intent)
that allows you to receive data back from the broadcast.

104 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/
Context#sendOrderedBroadcast(android.content.Intent,%20java.lang.String)
(/reference/android/content/Intent)
(/reference/java/lang/String)

Broadcast the given intent to all interested BroadcastReceivers, delivering the


one at a time to allow more preferred receivers to consume the broadcast be
it is delivered to less preferred receivers.

(/reference/android/content/
Context#sendOrderedBroadcastAsUser(android.content.Intent,
%20android.os.UserHandle,%20java.lang.String,
%20android.content.BroadcastReceiver,%20android.os.Handler,%20int,
%20java.lang.String,%20android.os.Bundle))
(/reference/android/content/Intent)
(/reference/android/os/UserHandle) (/reference/java/lang/St

(/reference/android/content/BroadcastReceiver)
(/reference/android/os/Handler)
(/reference/java/lang/String)
(/reference/android/os/Bundle)

Version of

(/reference/android/content/
Context#sendOrderedBroadcast(android.content.Intent,%20java.lang.String,
%20android.content.BroadcastReceiver,%20android.os.Handler,%20int,
%20java.lang.String,%20android.os.Bundle))
that allows you to specify the user the broadcast will be sent to.

105 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/
Context#sendStickyBroadcast(android.content.Intent))
(/reference/android/content/Intent)

This method was deprecated in API level 21. Sticky broadcasts should not be
used. They provide no security (anyone can access them), no protection (any
can modify them), and many other problems. The recommended pa�ern is to
a non-sticky broadcast to repo� that something has changed, with another
mechanism for apps to retrieve the current value whenever desired.

(/reference/android/content/
Context#sendStickyBroadcast(android.content.Intent,%20android.os.Bundle)
(/reference/android/content/Intent)
(/reference/android/os/Bundle)

This method was deprecated in API level 31. Sticky broadcasts should not be
used. They provide no security (anyone can access them), no protection (any
can modify them), and many other problems. The recommended pa�ern is to
a non-sticky broadcast to repo� that something has changed, with another
mechanism for apps to retrieve the current value whenever desired.

(/reference/android/content/
Context#sendStickyBroadcastAsUser(android.content.Intent,
%20android.os.UserHandle))
(/reference/android/content/Intent)
(/reference/android/os/UserHandle)

This method was deprecated in API level 21. Sticky broadcasts should not be
used. They provide no security (anyone can access them), no protection (any
can modify them), and many other problems. The recommended pa�ern is to

106 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

a non-sticky broadcast to repo� that something has changed, with another


mechanism for apps to retrieve the current value whenever desired.

(/reference/android/content/
Context#sendStickyOrderedBroadcast(android.content.Intent,
%20android.content.BroadcastReceiver,%20android.os.Handler,%20int,
%20java.lang.String,%20android.os.Bundle))
(/reference/android/content/Intent)
(/reference/android/content/BroadcastReceiver)
(/reference/android/os/Handler)
(/reference/java/lang/String)
(/reference/android/os/Bundle)

This method was deprecated in API level 21. Sticky broadcasts should not be
used. They provide no security (anyone can access them), no protection (any
can modify them), and many other problems. The recommended pa�ern is to
a non-sticky broadcast to repo� that something has changed, with another
mechanism for apps to retrieve the current value whenever desired.

(/reference/android/content/
Context#sendStickyOrderedBroadcastAsUser(android.content.Intent,
%20android.os.UserHandle,%20android.content.BroadcastReceiver,
%20android.os.Handler,%20int,%20java.lang.String,%20android.os.Bundle)
(/reference/android/content/Intent)
(/reference/android/os/UserHandle)
(/reference/android/content/BroadcastReceiver)
(/reference/android/os/Handler)
(/reference/java/lang/String)
(/reference/android/os/Bundle)

This method was deprecated in API level 21. Sticky broadcasts should not be
used. They provide no security (anyone can access them), no protection (any

107 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

can modify them), and many other problems. The recommended pa�ern is to
a non-sticky broadcast to repo� that something has changed, with another
mechanism for apps to retrieve the current value whenever desired.

(/reference/android/content/Context#setTheme(int))

Set the base theme for this context.

(/reference/android/content/Context#setWallpaper(android.graphics.Bitmap)
(/reference/android/graphics/Bitmap)

This method was deprecated in API level 15. Use


(/reference/android/app/
WallpaperManager#setBitmap(android.graphics.Bitmap))
instead.

This method requires the caller to hold the permission

(/reference/android/Manifest.permission#SET_WALLPAPER).

(/reference/android/content/Context#setWallpaper(java.io.InputStream)
(/reference/java/io/InputStream)

This method was deprecated in API level 15. Use


(/reference/android/app/WallpaperManager#setStream(java.io.InputStream)
instead.

This method requires the caller to hold the permission

(/reference/android/Manifest.permission#SET_WALLPAPER).

108 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/Context#sta�Activities(android.content.Intent[],
%20android.os.Bundle))
(/reference/android/content/Intent)
(/reference/android/os/Bundle)

Launch multiple new activities.

(/reference/android/content/Context#sta�Activities(android.content.Intent[])
(/reference/android/content/Intent)

Same as

(/reference/android/content/Context#sta�Activities(android.content.Intent[],
%20android.os.Bundle))
with no options speci�ed.

(/reference/android/content/Context#sta�Activity(android.content.Intent)
(/reference/android/content/Intent)

Same as

(/reference/android/content/Context#sta�Activity(android.content.Intent,
%20android.os.Bundle))
with no options speci�ed.

(/reference/android/content/Context#sta�Activity(android.content.Intent,
%20android.os.Bundle))
(/reference/android/content/Intent)
(/reference/android/os/Bundle)

109 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Launch a new activity.

(/reference/android/content/ComponentName)

(/reference/android/content/
Context#sta�ForegroundService(android.content.Intent))
(/reference/android/content/Intent)

Similar to
(/reference/android/content/Context#sta�Service(android.content.Intent)
with an implicit promise that the Service will call

(/reference/android/app/Service#sta�Foreground(int,
%20android.app.Noti�cation))
once it begins running.

(/reference/android/content/
Context#sta�Instrumentation(android.content.ComponentName,
%20java.lang.String,%20android.os.Bundle))
(/reference/android/content/ComponentName)
(/reference/java/lang/String)
(/reference/android/os/Bundle)

Sta� executing an (/reference/android/app/Instrumentati


class.

(/reference/android/content/
Context#sta�IntentSender(android.content.IntentSender,
%20android.content.Intent,%20int,%20int,%20int))
(/reference/android/content/IntentSender)
(/reference/android/content/Intent)

110 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Same as

(/reference/android/content/
Context#sta�IntentSender(android.content.IntentSender,
%20android.content.Intent,%20int,%20int,%20int,%20android.os.Bundle)
with no options speci�ed.

(/reference/android/content/
Context#sta�IntentSender(android.content.IntentSender,
%20android.content.Intent,%20int,%20int,%20int,%20android.os.Bundle)
(/reference/android/content/IntentSender)
(/reference/android/content/Intent)
(/reference/android/os/Bundle

Like
(/reference/android/content/Context#sta�Activity(android.content.Intent,
%20android.os.Bundle))
, but taking a IntentSender to sta�.

(/reference/android/content/ComponentName)
(/reference/android/content/Context#sta�Service(android.content.Intent)
(/reference/android/content/Intent)

Request that a given application service be sta�ed.

(/reference/android/content/Context#stopService(android.content.Intent)
(/reference/android/content/Intent)

Request that a given application service be stopped.

111 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

(/reference/android/content/
Context#unbindService(android.content.ServiceConnection))
(/reference/android/content/ServiceConnection

Disconnect from an application service.

(/reference/android/content/
Context#unregisterComponentCallbacks(android.content.ComponentCallbac
(/reference/android/content/ComponentCallbacks

Remove a
(/reference/android/content/ComponentCallbacks) object that was previously
registered with

(/reference/android/content/
Context#registerComponentCallbacks(android.content.ComponentCallbacks
.

(/reference/android/content/
Context#unregisterDeviceIdChangeListener(java.util.function.IntConsumer)
(/reference/java/util/function/IntConsumer)

Removes a device ID changed listener from the Context.

(/reference/android/content/
Context#unregisterReceiver(android.content.BroadcastReceiver)
(/reference/android/content/BroadcastReceiver

112 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Unregister a previously registered BroadcastReceiver.

(/reference/android/content/
Context#updateServiceGroup(android.content.ServiceConnection,%20int,
%20int))
(/reference/android/content/ServiceConnection

For a service previously bound with

(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Execu
%20android.content.ServiceConnection))
or a related method, change how the system manages that service's process
relation to other processes.

From class (/reference/java/lang/Object)


(/reference/java/lang/Object) (/reference/java/lang/Object#clone())

Creates and returns a copy of this object.

(/reference/java/lang/Object#equals(java.lang.Object)) (/reference/java/lang/Object)

Indicates whether some other object is "equal to" this one.

(/reference/java/lang/Object#�nalize())

Called by the garbage collector on an object when garbage collection determines that there are no more reference
the object.

(/reference/java/lang/Class)
(/reference/java/lang/Object#getClass())

113 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Returns the runtime class of this .

(/reference/java/lang/Object#hashCode())

Returns a hash code value for the object.

(/reference/java/lang/Object#notify())

Wakes up a single thread that is waiting on this object's monitor.

(/reference/java/lang/Object#notifyAll())

Wakes up all threads that are waiting on this object's monitor.

(/reference/java/lang/String)
(/reference/java/lang/Object#toString())

Returns a string representation of the object.

(/reference/java/lang/Object#wait(long,%20int))

Causes the current thread to wait until it is awakened, typically by being noti�ed or interrupted, or until a ce�ain
amount of real time has elapsed.

(/reference/java/lang/Object#wait(long))

Causes the current thread to wait until it is awakened, typically by being noti�ed or interrupted, or until a ce�ain
amount of real time has elapsed.

(/reference/java/lang/Object#wait())

Causes the current thread to wait until it is awakened, typically by being noti�ed or interrupted.

114 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

From inte�ace (/reference/android/content/ComponentCallbacks2)


(/reference/android/content/ComponentCallbacks2#onTrimMemory(int))

Called when the operating system has determined that it is a good time for a process to trim unneeded memory from its proces

From inte�ace (/reference/android/content/ComponentCallbacks)

(/reference/android/content/ComponentCallbacks#onCon�gurationChanged(android.content.res.Con�guration))
(/reference/android/content/res/Con�guration)

Called by the system when the device con�guration changes while your component is running.

(/reference/android/content/ComponentCallbacks#onLowMemory())

This is called when the overall system is running low on memory, and actively running processes should trim their memory usage

Added in API level 3 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public IntentService ( (/reference/java/lang/String) name)

Creates an IntentService. Invoked by your subclass's constructor.

115 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Parameters

: Used to name the worker thread, impo�ant only for debugging.

Added in API level 3 (/guide/topics/manifest/uses-sdk-element#ApiLevels)


Deprecated in API level 30 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public (/reference/android/os/IBinder) onBind ( (/reference/android/content/Intent) intent)

Unless you provide binding for your service, you don't need to implement this method, because the default implementation returns
null.

Parameters

: The Intent that was used to bind to this service, as given to


(/reference/android/content/Context#bindService(android.content.Intent,
%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,
%20android.content.ServiceConnection))
. Note that any extras that were included with the Intent at that point will not be seen here.

116 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Returns

Return an IBinder through which clients can call on to the service.


(/reference/android/os/IBinder)

See also:

(/reference/android/app/Service#onBind(android.content.Intent))

Added in API level 3 (/guide/topics/manifest/uses-sdk-element#ApiLevels)


Deprecated in API level 30 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public void onCreate ()

Called by the system when the service is �rst created. Do not call this method directly.

Added in API level 3 (/guide/topics/manifest/uses-sdk-element#ApiLevels)


Deprecated in API level 30 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public void onDestroy ()

117 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Called by the system to notify a Service that it is no longer used and is being removed. The service should clean up any resources it
holds (threads, registered receivers, etc) at this point. Upon return, there will be no more calls in to this Service object and it is
e�ectively dead. Do not call this method directly.

Added in API level 3 (/guide/topics/manifest/uses-sdk-element#ApiLevels)


Deprecated in API level 30 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public void onStart ( (/reference/android/content/Intent) intent,


int startId)

This method was deprecated in API level 30.


Implement
(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int)) instead.

Parameters

: This value may be .

118 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Added in API level 5 (/guide/topics/manifest/uses-sdk-element#ApiLevels)


Deprecated in API level 30 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public int onStartCommand ( (/reference/android/content/Intent) intent,


int flags,
int startId)

You should not override this method for your IntentService. Instead, override
(/reference/android/app/IntentService#onHandleIntent(android.content.Intent)) , which the system calls when the IntentService receives a
sta� request.

Parameters

: This value may be .

: Additional data about this sta� request. Value is either or a combination of


(/reference/android/app/Service#START_FLAG_REDELIVERY), and
(/reference/android/app/Service#START_FLAG_RETRY)

: A unique integer representing this speci�c request to sta�. Use with


(/reference/android/app/Service#stopSelfResult(int)).

119 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Returns

The return value indicates what semantics the system should use for the service's current sta�ed state. It may be
one of the constants associated with the
(/reference/android/app/Service#START_CONTINUATION_MASK) bits. Value is
(/reference/android/app/Service#START_STICKY_COMPATIBILITY),
(/reference/android/app/Service#START_STICKY),
(/reference/android/app/Service#START_NOT_STICKY), or
(/reference/android/app/Service#START_REDELIVER_INTENT)

See also:

(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int))

Added in API level 5 (/guide/topics/manifest/uses-sdk-element#ApiLevels)


Deprecated in API level 30 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public void setIntentRedelivery (boolean enabled)

Sets intent redelivery preferences. Usually called from the constructor with your preferred semantics.

If enabled is true,
(/reference/android/app/IntentService#onSta�Command(android.content.Intent,%20int,%20int)) will return
(/reference/android/app/Service#START_REDELIVER_INTENT) , so if this process dies before
(/reference/android/app/IntentService#onHandleIntent(android.content.Intent)) returns, the process will be resta�ed and the intent

120 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

redelivered. If multiple Intents have been sent, only the most recent one is guaranteed to be redelivered.

If enabled is false (the default),


(/reference/android/app/IntentService#onSta�Command(android.content.Intent,%20int,%20int)) will return
(/reference/android/app/Service#START_NOT_STICKY) , and if the process dies, the Intent dies along with it.

Parameters

Added in API level 3 (/guide/topics/manifest/uses-sdk-element#ApiLevels)


Deprecated in API level 30 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

protected abstract void onHandleIntent ( (/reference/android/content/Intent) intent)

This method is invoked on the worker thread with a request to process. Only one Intent is processed at a time, but the processing
happens on a worker thread that runs independently from other application logic. So, if this code takes a long time, it will hold up
other requests to the same IntentService, but it will not hold up anything else. When all requests have been handled, the
IntentService stops itself, so you should not call (/reference/android/app/Service#stopSelf()) .
This method may take several seconds to complete, so it should only be called from a worker thread.

121 de 122 31-01-2024, 16:05


Firefox https://developer.android.com/reference/android/app/IntentService

Parameters

: The value passed to


(/reference/android/content/Context#sta�Service(android.content.Intent)). This may be null if the service is being
resta�ed a�er its process has gone away; see
(/reference/android/app/Service#onSta�Command(android.content.Intent,%20int,%20int)) for details.

Content and code samples on this page are subject to the licenses described in the Content License (/license). Java and OpenJDK are trademarks or registered
trademarks of Oracle and/or its a�liates.

Last updated 2023-12-15 UTC.

122 de 122 31-01-2024, 16:05

You might also like