Application  |  API reference  |  Android Developers (original) (raw)

boolean

[bindIsolatedService](/reference/android/content/Context#bindIsolatedService%28android.content.Intent,%20int,%20java.lang.String,%20java.util.concurrent.Executor,%20android.content.ServiceConnection%29)([Intent](/reference/android/content/Intent) service, int flags, [String](/reference/java/lang/String) instanceName, [Executor](/reference/java/util/concurrent/Executor) executor, [ServiceConnection](/reference/android/content/ServiceConnection) conn)

Variation of [bindService(Intent, BindServiceFlags, Executor, ServiceConnection)](/reference/android/content/Context#bindService%28android.content.Intent,%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,%20android.content.ServiceConnection%29) that, in the specific case of isolated services, allows the caller to generate multiple instances of a service from a single component declaration.

boolean

[bindIsolatedService](/reference/android/content/Context#bindIsolatedService%28android.content.Intent,%20android.content.Context.BindServiceFlags,%20java.lang.String,%20java.util.concurrent.Executor,%20android.content.ServiceConnection%29)([Intent](/reference/android/content/Intent) service, [Context.BindServiceFlags](/reference/android/content/Context.BindServiceFlags) flags, [String](/reference/java/lang/String) instanceName, [Executor](/reference/java/util/concurrent/Executor) executor, [ServiceConnection](/reference/android/content/ServiceConnection) conn)

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

boolean

[bindService](/reference/android/content/Context#bindService%28android.content.Intent,%20int,%20java.util.concurrent.Executor,%20android.content.ServiceConnection%29)([Intent](/reference/android/content/Intent) service, int flags, [Executor](/reference/java/util/concurrent/Executor) executor, [ServiceConnection](/reference/android/content/ServiceConnection) conn)

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

boolean

[bindService](/reference/android/content/Context#bindService%28android.content.Intent,%20android.content.ServiceConnection,%20android.content.Context.BindServiceFlags%29)([Intent](/reference/android/content/Intent) service, [ServiceConnection](/reference/android/content/ServiceConnection) conn, [Context.BindServiceFlags](/reference/android/content/Context.BindServiceFlags) flags)

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

abstract boolean

[bindService](/reference/android/content/Context#bindService%28android.content.Intent,%20android.content.ServiceConnection,%20int%29)([Intent](/reference/android/content/Intent) service, [ServiceConnection](/reference/android/content/ServiceConnection) conn, int flags)

Connects to an application service, creating it if needed.

boolean

[bindService](/reference/android/content/Context#bindService%28android.content.Intent,%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,%20android.content.ServiceConnection%29)([Intent](/reference/android/content/Intent) service, [Context.BindServiceFlags](/reference/android/content/Context.BindServiceFlags) flags, [Executor](/reference/java/util/concurrent/Executor) executor, [ServiceConnection](/reference/android/content/ServiceConnection) conn)

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

boolean

[bindServiceAsUser](/reference/android/content/Context#bindServiceAsUser%28android.content.Intent,%20android.content.ServiceConnection,%20int,%20android.os.UserHandle%29)([Intent](/reference/android/content/Intent) service, [ServiceConnection](/reference/android/content/ServiceConnection) conn, int flags, [UserHandle](/reference/android/os/UserHandle) user)

Binds to a service in the given user in the same manner as [bindService(Intent, BindServiceFlags, Executor, ServiceConnection)](/reference/android/content/Context#bindService%28android.content.Intent,%20android.content.Context.BindServiceFlags,%20java.util.concurrent.Executor,%20android.content.ServiceConnection%29).

boolean

[bindServiceAsUser](/reference/android/content/Context#bindServiceAsUser%28android.content.Intent,%20android.content.ServiceConnection,%20android.content.Context.BindServiceFlags,%20android.os.UserHandle%29)([Intent](/reference/android/content/Intent) service, [ServiceConnection](/reference/android/content/ServiceConnection) conn, [Context.BindServiceFlags](/reference/android/content/Context.BindServiceFlags) flags, [UserHandle](/reference/android/os/UserHandle) user)

See [bindServiceAsUser(Intent,ServiceConnection,int,UserHandle)](/reference/android/content/Context#bindServiceAsUser%28android.content.Intent,%20android.content.ServiceConnection,%20int,%20android.os.UserHandle%29) Call [BindServiceFlags.of(long)](/reference/android/content/Context.BindServiceFlags#of%28long%29) to obtain a BindServiceFlags object.

abstract int

[checkCallingOrSelfPermission](/reference/android/content/Context#checkCallingOrSelfPermission%28java.lang.String%29)([String](/reference/java/lang/String) permission)

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

abstract int

[checkCallingOrSelfUriPermission](/reference/android/content/Context#checkCallingOrSelfUriPermission%28android.net.Uri,%20int%29)([Uri](/reference/android/net/Uri) uri, int modeFlags)

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

int[]

[checkCallingOrSelfUriPermissions](/reference/android/content/Context#checkCallingOrSelfUriPermissions%28java.util.List<android.net.Uri>,%20int%29)([List](/reference/java/util/List)<[Uri](/reference/android/net/Uri)> uris, int modeFlags)

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

abstract int

[checkCallingPermission](/reference/android/content/Context#checkCallingPermission%28java.lang.String%29)([String](/reference/java/lang/String) permission)

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

abstract int

[checkCallingUriPermission](/reference/android/content/Context#checkCallingUriPermission%28android.net.Uri,%20int%29)([Uri](/reference/android/net/Uri) uri, int modeFlags)

Determine whether the calling process and uid has been granted permission to access a specific URI.

int[]

[checkCallingUriPermissions](/reference/android/content/Context#checkCallingUriPermissions%28java.util.List<android.net.Uri>,%20int%29)([List](/reference/java/util/List)<[Uri](/reference/android/net/Uri)> uris, int modeFlags)

Determine whether the calling process and uid has been granted permission to access a list of URIs.

int

[checkContentUriPermissionFull](/reference/android/content/Context#checkContentUriPermissionFull%28android.net.Uri,%20int,%20int,%20int%29)([Uri](/reference/android/net/Uri) uri, int pid, int uid, int modeFlags)

Determine whether a particular process and uid has been granted permission to access a specific content URI.

abstract int

[checkPermission](/reference/android/content/Context#checkPermission%28java.lang.String,%20int,%20int%29)([String](/reference/java/lang/String) permission, int pid, int uid)

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

abstract int

[checkSelfPermission](/reference/android/content/Context#checkSelfPermission%28java.lang.String%29)([String](/reference/java/lang/String) permission)

Determine whether you have been granted a particular permission.

abstract int

[checkUriPermission](/reference/android/content/Context#checkUriPermission%28android.net.Uri,%20java.lang.String,%20java.lang.String,%20int,%20int,%20int%29)([Uri](/reference/android/net/Uri) uri, [String](/reference/java/lang/String) readPermission, [String](/reference/java/lang/String) writePermission, int pid, int uid, int modeFlags)

Check both a Uri and normal permission.

abstract int

[checkUriPermission](/reference/android/content/Context#checkUriPermission%28android.net.Uri,%20int,%20int,%20int%29)([Uri](/reference/android/net/Uri) uri, int pid, int uid, int modeFlags)

Determine whether a particular process and uid has been granted permission to access a specific URI.

int[]

[checkUriPermissions](/reference/android/content/Context#checkUriPermissions%28java.util.List<android.net.Uri>,%20int,%20int,%20int%29)([List](/reference/java/util/List)<[Uri](/reference/android/net/Uri)> uris, int pid, int uid, int modeFlags)

Determine whether a particular process and uid has been granted permission to access a list of URIs.

abstract void

[clearWallpaper](/reference/android/content/Context#clearWallpaper%28%29)()

This method was deprecated in API level 15. Use [WallpaperManager.clear()](/reference/android/app/WallpaperManager#clear%28%29) instead.

This method requires the caller to hold the permission[Manifest.permission.SETWALLPAPER](/reference/android/Manifest.permission#SET%5FWALLPAPER).

[Context](/reference/android/content/Context)

[createAttributionContext](/reference/android/content/Context#createAttributionContext%28java.lang.String%29)([String](/reference/java/lang/String) attributionTag)

Return a new Context object for the current Context but attribute to a different tag.

abstract[Context](/reference/android/content/Context)

[createConfigurationContext](/reference/android/content/Context#createConfigurationContext%28android.content.res.Configuration%29)([Configuration](/reference/android/content/res/Configuration) overrideConfiguration)

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

[Context](/reference/android/content/Context)

[createContext](/reference/android/content/Context#createContext%28android.content.ContextParams%29)([ContextParams](/reference/android/content/ContextParams) contextParams)

Creates a context with specific properties and behaviors.

abstract[Context](/reference/android/content/Context)

[createContextForSplit](/reference/android/content/Context#createContextForSplit%28java.lang.String%29)([String](/reference/java/lang/String) splitName)

Return a new Context object for the given split name.

[Context](/reference/android/content/Context)

[createDeviceContext](/reference/android/content/Context#createDeviceContext%28int%29)(int deviceId)

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

abstract[Context](/reference/android/content/Context)

[createDeviceProtectedStorageContext](/reference/android/content/Context#createDeviceProtectedStorageContext%28%29)()

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

abstract[Context](/reference/android/content/Context)

[createDisplayContext](/reference/android/content/Context#createDisplayContext%28android.view.Display%29)([Display](/reference/android/view/Display) display)

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

abstract[Context](/reference/android/content/Context)

[createPackageContext](/reference/android/content/Context#createPackageContext%28java.lang.String,%20int%29)([String](/reference/java/lang/String) packageName, int flags)

Return a new Context object for the given application name.

[Context](/reference/android/content/Context)

[createWindowContext](/reference/android/content/Context#createWindowContext%28int,%20android.os.Bundle%29)(int type, [Bundle](/reference/android/os/Bundle) options)

Creates a Context for a non-activity window.

[Context](/reference/android/content/Context)

[createWindowContext](/reference/android/content/Context#createWindowContext%28android.view.Display,%20int,%20android.os.Bundle%29)([Display](/reference/android/view/Display) display, int type, [Bundle](/reference/android/os/Bundle) options)

Creates a Context for a non-[activity](/reference/android/app/Activity) window on the given[Display](/reference/android/view/Display).

abstract[String[]](/reference/java/lang/String)

[databaseList](/reference/android/content/Context#databaseList%28%29)()

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

abstract boolean

[deleteDatabase](/reference/android/content/Context#deleteDatabase%28java.lang.String%29)([String](/reference/java/lang/String) name)

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

abstract boolean

[deleteFile](/reference/android/content/Context#deleteFile%28java.lang.String%29)([String](/reference/java/lang/String) name)

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

abstract boolean

[deleteSharedPreferences](/reference/android/content/Context#deleteSharedPreferences%28java.lang.String%29)([String](/reference/java/lang/String) name)

Delete an existing shared preferences file.

abstract void

[enforceCallingOrSelfPermission](/reference/android/content/Context#enforceCallingOrSelfPermission%28java.lang.String,%20java.lang.String%29)([String](/reference/java/lang/String) permission, [String](/reference/java/lang/String) message)

If neither you nor the calling process of an IPC you are handling has been granted a particular permission, throw a[SecurityException](/reference/java/lang/SecurityException).

abstract void

[enforceCallingOrSelfUriPermission](/reference/android/content/Context#enforceCallingOrSelfUriPermission%28android.net.Uri,%20int,%20java.lang.String%29)([Uri](/reference/android/net/Uri) uri, int modeFlags, [String](/reference/java/lang/String) message)

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

abstract void

[enforceCallingPermission](/reference/android/content/Context#enforceCallingPermission%28java.lang.String,%20java.lang.String%29)([String](/reference/java/lang/String) permission, [String](/reference/java/lang/String) message)

If the calling process of an IPC you are handling has not been granted a particular permission, throw a [SecurityException](/reference/java/lang/SecurityException).

abstract void

[enforceCallingUriPermission](/reference/android/content/Context#enforceCallingUriPermission%28android.net.Uri,%20int,%20java.lang.String%29)([Uri](/reference/android/net/Uri) uri, int modeFlags, [String](/reference/java/lang/String) message)

If the calling process and uid has not been granted permission to access a specific URI, throw [SecurityException](/reference/java/lang/SecurityException).

abstract void

[enforcePermission](/reference/android/content/Context#enforcePermission%28java.lang.String,%20int,%20int,%20java.lang.String%29)([String](/reference/java/lang/String) permission, int pid, int uid, [String](/reference/java/lang/String) message)

If the given permission is not allowed for a particular process and user ID running in the system, throw a [SecurityException](/reference/java/lang/SecurityException).

abstract void

[enforceUriPermission](/reference/android/content/Context#enforceUriPermission%28android.net.Uri,%20java.lang.String,%20java.lang.String,%20int,%20int,%20int,%20java.lang.String%29)([Uri](/reference/android/net/Uri) uri, [String](/reference/java/lang/String) readPermission, [String](/reference/java/lang/String) writePermission, int pid, int uid, int modeFlags, [String](/reference/java/lang/String) message)

Enforce both a Uri and normal permission.

abstract void

[enforceUriPermission](/reference/android/content/Context#enforceUriPermission%28android.net.Uri,%20int,%20int,%20int,%20java.lang.String%29)([Uri](/reference/android/net/Uri) uri, int pid, int uid, int modeFlags, [String](/reference/java/lang/String) message)

If a particular process and uid has not been granted permission to access a specific URI, throw [SecurityException](/reference/java/lang/SecurityException).

abstract[String[]](/reference/java/lang/String)

[fileList](/reference/android/content/Context#fileList%28%29)()

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

abstract[Context](/reference/android/content/Context)

[getApplicationContext](/reference/android/content/Context#getApplicationContext%28%29)()

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

abstract[ApplicationInfo](/reference/android/content/pm/ApplicationInfo)

[getApplicationInfo](/reference/android/content/Context#getApplicationInfo%28%29)()

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

abstract[AssetManager](/reference/android/content/res/AssetManager)

[getAssets](/reference/android/content/Context#getAssets%28%29)()

Returns an AssetManager instance for the application's package.

[AttributionSource](/reference/android/content/AttributionSource)

[getAttributionSource](/reference/android/content/Context#getAttributionSource%28%29)()

[String](/reference/java/lang/String)

[getAttributionTag](/reference/android/content/Context#getAttributionTag%28%29)()

Attribution can be used in complex apps to logically separate parts of the app.

abstract[File](/reference/java/io/File)

[getCacheDir](/reference/android/content/Context#getCacheDir%28%29)()

Returns the absolute path to the application specific cache directory on the filesystem.

abstract[ClassLoader](/reference/java/lang/ClassLoader)

[getClassLoader](/reference/android/content/Context#getClassLoader%28%29)()

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

abstract[File](/reference/java/io/File)

[getCodeCacheDir](/reference/android/content/Context#getCodeCacheDir%28%29)()

Returns the absolute path to the application specific cache directory on the filesystem designed for storing cached code.

final int

[getColor](/reference/android/content/Context#getColor%28int%29)(int id)

Returns a color associated with a particular resource ID and styled for the current theme.

final[ColorStateList](/reference/android/content/res/ColorStateList)

[getColorStateList](/reference/android/content/Context#getColorStateList%28int%29)(int id)

Returns a color state list associated with a particular resource ID and styled for the current theme.

abstract[ContentResolver](/reference/android/content/ContentResolver)

[getContentResolver](/reference/android/content/Context#getContentResolver%28%29)()

Return a ContentResolver instance for your application's package.

abstract[File](/reference/java/io/File)

[getDataDir](/reference/android/content/Context#getDataDir%28%29)()

Returns the absolute path to the directory on the filesystem where all private files belonging to this app are stored.

abstract[File](/reference/java/io/File)

[getDatabasePath](/reference/android/content/Context#getDatabasePath%28java.lang.String%29)([String](/reference/java/lang/String) name)

Returns the absolute path on the filesystem where a database created with[openOrCreateDatabase(String, int, CursorFactory)](/reference/android/content/Context#openOrCreateDatabase%28java.lang.String,%20int,%20android.database.sqlite.SQLiteDatabase.CursorFactory%29) is stored.

int

[getDeviceId](/reference/android/content/Context#getDeviceId%28%29)()

Gets the device ID this context is associated with.

abstract[File](/reference/java/io/File)

[getDir](/reference/android/content/Context#getDir%28java.lang.String,%20int%29)([String](/reference/java/lang/String) name, int mode)

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

[Display](/reference/android/view/Display)

[getDisplay](/reference/android/content/Context#getDisplay%28%29)()

Get the display this context is associated with.

final[Drawable](/reference/android/graphics/drawable/Drawable)

[getDrawable](/reference/android/content/Context#getDrawable%28int%29)(int id)

Returns a drawable object associated with a particular resource ID and styled for the current theme.

abstract[File](/reference/java/io/File)

[getExternalCacheDir](/reference/android/content/Context#getExternalCacheDir%28%29)()

Returns absolute path to application-specific directory on the primary shared/external storage device where the application can place cache files it owns.

abstract[File[]](/reference/java/io/File)

[getExternalCacheDirs](/reference/android/content/Context#getExternalCacheDirs%28%29)()

Returns absolute paths to application-specific directories on all shared/external storage devices where the application can place cache files it owns.

abstract[File](/reference/java/io/File)

[getExternalFilesDir](/reference/android/content/Context#getExternalFilesDir%28java.lang.String%29)([String](/reference/java/lang/String) type)

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

abstract[File[]](/reference/java/io/File)

[getExternalFilesDirs](/reference/android/content/Context#getExternalFilesDirs%28java.lang.String%29)([String](/reference/java/lang/String) type)

Returns absolute paths to application-specific directories on all shared/external storage devices where the application can place persistent files it owns.

abstract[File[]](/reference/java/io/File)

[getExternalMediaDirs](/reference/android/content/Context#getExternalMediaDirs%28%29)()

This method was deprecated in API level 30. These directories still exist and are scanned, but developers are encouraged to migrate to inserting content into a[MediaStore](/reference/android/provider/MediaStore) collection directly, as any app can contribute new media to [MediaStore](/reference/android/provider/MediaStore) with no permissions required, starting in[Build.VERSIONCODES.Q](/reference/android/os/Build.VERSION%5FCODES#Q).

abstract[File](/reference/java/io/File)

[getFileStreamPath](/reference/android/content/Context#getFileStreamPath%28java.lang.String%29)([String](/reference/java/lang/String) name)

Returns the absolute path on the filesystem where a file created with[openFileOutput(String, int)](/reference/android/content/Context#openFileOutput%28java.lang.String,%20int%29) is stored.

abstract[File](/reference/java/io/File)

[getFilesDir](/reference/android/content/Context#getFilesDir%28%29)()

Returns the absolute path to the directory on the filesystem where files created with [openFileOutput(String, int)](/reference/android/content/Context#openFileOutput%28java.lang.String,%20int%29) are stored.

[Executor](/reference/java/util/concurrent/Executor)

[getMainExecutor](/reference/android/content/Context#getMainExecutor%28%29)()

Return an [Executor](/reference/java/util/concurrent/Executor) that will run enqueued tasks on the main thread associated with this context.

abstract[Looper](/reference/android/os/Looper)

[getMainLooper](/reference/android/content/Context#getMainLooper%28%29)()

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

abstract[File](/reference/java/io/File)

[getNoBackupFilesDir](/reference/android/content/Context#getNoBackupFilesDir%28%29)()

Returns the absolute path to the directory on the filesystem similar to[getFilesDir()](/reference/android/content/Context#getFilesDir%28%29).

abstract[File](/reference/java/io/File)

[getObbDir](/reference/android/content/Context#getObbDir%28%29)()

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

abstract[File[]](/reference/java/io/File)

[getObbDirs](/reference/android/content/Context#getObbDirs%28%29)()

Returns absolute paths to application-specific directories on all shared/external storage devices where the application's OBB files (if there are any) can be found.

[String](/reference/java/lang/String)

[getOpPackageName](/reference/android/content/Context#getOpPackageName%28%29)()

Return the package name that should be used for [AppOpsManager](/reference/android/app/AppOpsManager) calls from this context, so that app ops manager's uid verification will work with the name.

abstract[String](/reference/java/lang/String)

[getPackageCodePath](/reference/android/content/Context#getPackageCodePath%28%29)()

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

abstract[PackageManager](/reference/android/content/pm/PackageManager)

[getPackageManager](/reference/android/content/Context#getPackageManager%28%29)()

Return PackageManager instance to find global package information.

abstract[String](/reference/java/lang/String)

[getPackageName](/reference/android/content/Context#getPackageName%28%29)()

Return the name of this application's package.

abstract[String](/reference/java/lang/String)

[getPackageResourcePath](/reference/android/content/Context#getPackageResourcePath%28%29)()

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

[ContextParams](/reference/android/content/ContextParams)

[getParams](/reference/android/content/Context#getParams%28%29)()

Return the set of parameters which this Context was created with, if it was created via [createContext(ContextParams)](/reference/android/content/Context#createContext%28android.content.ContextParams%29).

abstract[Resources](/reference/android/content/res/Resources)

[getResources](/reference/android/content/Context#getResources%28%29)()

Returns a Resources instance for the application's package.

abstract[SharedPreferences](/reference/android/content/SharedPreferences)

[getSharedPreferences](/reference/android/content/Context#getSharedPreferences%28java.lang.String,%20int%29)([String](/reference/java/lang/String) name, int mode)

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

final[String](/reference/java/lang/String)

[getString](/reference/android/content/Context#getString%28int%29)(int resId)

Returns a localized string from the application's package's default string table.

final[String](/reference/java/lang/String)

[getString](/reference/android/content/Context#getString%28int,%20java.lang.Object[]%29)(int resId, [Object...](/reference/java/lang/Object) formatArgs)

Returns a localized formatted string from the application's package's default string table, substituting the format arguments as defined in[Formatter](/reference/java/util/Formatter) and [String.format(String, Object)](/reference/java/lang/String#format%28java.lang.String,%20java.lang.Object[]%29).

final <T> T

[getSystemService](/reference/android/content/Context#getSystemService%28java.lang.Class<T>%29)([Class](/reference/java/lang/Class)<T> serviceClass)

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

abstract[Object](/reference/java/lang/Object)

[getSystemService](/reference/android/content/Context#getSystemService%28java.lang.String%29)([String](/reference/java/lang/String) name)

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

abstract[String](/reference/java/lang/String)

[getSystemServiceName](/reference/android/content/Context#getSystemServiceName%28java.lang.Class<?>%29)([Class](/reference/java/lang/Class)<?> serviceClass)

Gets the name of the system-level service that is represented by the specified class.

final[CharSequence](/reference/java/lang/CharSequence)

[getText](/reference/android/content/Context#getText%28int%29)(int resId)

Return a localized, styled CharSequence from the application's package's default string table.

abstract[Resources.Theme](/reference/android/content/res/Resources.Theme)

[getTheme](/reference/android/content/Context#getTheme%28%29)()

Return the Theme object associated with this Context.

[Context.BindServiceFlags](/reference/android/content/Context.BindServiceFlags)

[getUpdateableFlags](/reference/android/content/Context#getUpdateableFlags%28%29)()

Gets the list of bind flags that may be updated (i.e.

abstract[Drawable](/reference/android/graphics/drawable/Drawable)

[getWallpaper](/reference/android/content/Context#getWallpaper%28%29)()

This method was deprecated in API level 15. Use [WallpaperManager.get()](/reference/android/app/WallpaperManager#getDrawable%28%29) instead.

abstract int

[getWallpaperDesiredMinimumHeight](/reference/android/content/Context#getWallpaperDesiredMinimumHeight%28%29)()

This method was deprecated in API level 15. Use [WallpaperManager.getDesiredMinimumHeight()](/reference/android/app/WallpaperManager#getDesiredMinimumHeight%28%29) instead.

abstract int

[getWallpaperDesiredMinimumWidth](/reference/android/content/Context#getWallpaperDesiredMinimumWidth%28%29)()

This method was deprecated in API level 15. Use [WallpaperManager.getDesiredMinimumWidth()](/reference/android/app/WallpaperManager#getDesiredMinimumWidth%28%29) instead.

abstract void

[grantUriPermission](/reference/android/content/Context#grantUriPermission%28java.lang.String,%20android.net.Uri,%20int%29)([String](/reference/java/lang/String) toPackage, [Uri](/reference/android/net/Uri) uri, int modeFlags)

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

abstract boolean

[isDeviceProtectedStorage](/reference/android/content/Context#isDeviceProtectedStorage%28%29)()

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

boolean

[isRestricted](/reference/android/content/Context#isRestricted%28%29)()

Indicates whether this Context is restricted.

boolean

[isUiContext](/reference/android/content/Context#isUiContext%28%29)()

Returns true if the context is a UI context which can access UI components such as[WindowManager](/reference/android/view/WindowManager), [LayoutInflater](/reference/android/view/LayoutInflater) or[WallpaperManager](/reference/android/app/WallpaperManager).

abstract boolean

[moveDatabaseFrom](/reference/android/content/Context#moveDatabaseFrom%28android.content.Context,%20java.lang.String%29)([Context](/reference/android/content/Context) sourceContext, [String](/reference/java/lang/String) name)

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

abstract boolean

[moveSharedPreferencesFrom](/reference/android/content/Context#moveSharedPreferencesFrom%28android.content.Context,%20java.lang.String%29)([Context](/reference/android/content/Context) sourceContext, [String](/reference/java/lang/String) name)

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

final[TypedArray](/reference/android/content/res/TypedArray)

[obtainStyledAttributes](/reference/android/content/Context#obtainStyledAttributes%28android.util.AttributeSet,%20int[]%29)([AttributeSet](/reference/android/util/AttributeSet) set, int[] attrs)

Retrieve styled attribute information in this Context's theme.

final[TypedArray](/reference/android/content/res/TypedArray)

[obtainStyledAttributes](/reference/android/content/Context#obtainStyledAttributes%28android.util.AttributeSet,%20int[],%20int,%20int%29)([AttributeSet](/reference/android/util/AttributeSet) set, int[] attrs, int defStyleAttr, int defStyleRes)

Retrieve styled attribute information in this Context's theme.

final[TypedArray](/reference/android/content/res/TypedArray)

[obtainStyledAttributes](/reference/android/content/Context#obtainStyledAttributes%28int,%20int[]%29)(int resid, int[] attrs)

Retrieve styled attribute information in this Context's theme.

final[TypedArray](/reference/android/content/res/TypedArray)

[obtainStyledAttributes](/reference/android/content/Context#obtainStyledAttributes%28int[]%29)(int[] attrs)

Retrieve styled attribute information in this Context's theme.

abstract[FileInputStream](/reference/java/io/FileInputStream)

[openFileInput](/reference/android/content/Context#openFileInput%28java.lang.String%29)([String](/reference/java/lang/String) name)

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

abstract[FileOutputStream](/reference/java/io/FileOutputStream)

[openFileOutput](/reference/android/content/Context#openFileOutput%28java.lang.String,%20int%29)([String](/reference/java/lang/String) name, int mode)

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

abstract[SQLiteDatabase](/reference/android/database/sqlite/SQLiteDatabase)

[openOrCreateDatabase](/reference/android/content/Context#openOrCreateDatabase%28java.lang.String,%20int,%20android.database.sqlite.SQLiteDatabase.CursorFactory,%20android.database.DatabaseErrorHandler%29)([String](/reference/java/lang/String) name, int mode, [SQLiteDatabase.CursorFactory](/reference/android/database/sqlite/SQLiteDatabase.CursorFactory) factory, [DatabaseErrorHandler](/reference/android/database/DatabaseErrorHandler) errorHandler)

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

abstract[SQLiteDatabase](/reference/android/database/sqlite/SQLiteDatabase)

[openOrCreateDatabase](/reference/android/content/Context#openOrCreateDatabase%28java.lang.String,%20int,%20android.database.sqlite.SQLiteDatabase.CursorFactory%29)([String](/reference/java/lang/String) name, int mode, [SQLiteDatabase.CursorFactory](/reference/android/database/sqlite/SQLiteDatabase.CursorFactory) factory)

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

abstract[Drawable](/reference/android/graphics/drawable/Drawable)

[peekWallpaper](/reference/android/content/Context#peekWallpaper%28%29)()

This method was deprecated in API level 15. Use [WallpaperManager.peek()](/reference/android/app/WallpaperManager#peekDrawable%28%29) instead.

void

[rebindService](/reference/android/content/Context#rebindService%28android.content.ServiceConnection,%20android.content.Context.BindServiceFlags%29)([ServiceConnection](/reference/android/content/ServiceConnection) conn, [Context.BindServiceFlags](/reference/android/content/Context.BindServiceFlags) flags)

Rebind an application service with updated bind service flags

void

[registerComponentCallbacks](/reference/android/content/Context#registerComponentCallbacks%28android.content.ComponentCallbacks%29)([ComponentCallbacks](/reference/android/content/ComponentCallbacks) callback)

Add a new [ComponentCallbacks](/reference/android/content/ComponentCallbacks) to the base application of the Context, which will be called at the same times as the ComponentCallbacks methods of activities and other components are called.

void

[registerDeviceIdChangeListener](/reference/android/content/Context#registerDeviceIdChangeListener%28java.util.concurrent.Executor,%20java.util.function.IntConsumer%29)([Executor](/reference/java/util/concurrent/Executor) executor, [IntConsumer](/reference/java/util/function/IntConsumer) listener)

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

abstract[Intent](/reference/android/content/Intent)

[registerReceiver](/reference/android/content/Context#registerReceiver%28android.content.BroadcastReceiver,%20android.content.IntentFilter%29)([BroadcastReceiver](/reference/android/content/BroadcastReceiver) receiver, [IntentFilter](/reference/android/content/IntentFilter) filter)

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

abstract[Intent](/reference/android/content/Intent)

[registerReceiver](/reference/android/content/Context#registerReceiver%28android.content.BroadcastReceiver,%20android.content.IntentFilter,%20int%29)([BroadcastReceiver](/reference/android/content/BroadcastReceiver) receiver, [IntentFilter](/reference/android/content/IntentFilter) filter, int flags)

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

abstract[Intent](/reference/android/content/Intent)

[registerReceiver](/reference/android/content/Context#registerReceiver%28android.content.BroadcastReceiver,%20android.content.IntentFilter,%20java.lang.String,%20android.os.Handler,%20int%29)([BroadcastReceiver](/reference/android/content/BroadcastReceiver) receiver, [IntentFilter](/reference/android/content/IntentFilter) filter, [String](/reference/java/lang/String) broadcastPermission, [Handler](/reference/android/os/Handler) scheduler, int flags)

Register to receive intent broadcasts, to run in the context ofscheduler.

abstract[Intent](/reference/android/content/Intent)

[registerReceiver](/reference/android/content/Context#registerReceiver%28android.content.BroadcastReceiver,%20android.content.IntentFilter,%20java.lang.String,%20android.os.Handler%29)([BroadcastReceiver](/reference/android/content/BroadcastReceiver) receiver, [IntentFilter](/reference/android/content/IntentFilter) filter, [String](/reference/java/lang/String) broadcastPermission, [Handler](/reference/android/os/Handler) scheduler)

Register to receive intent broadcasts, to run in the context ofscheduler.

abstract void

[removeStickyBroadcast](/reference/android/content/Context#removeStickyBroadcast%28android.content.Intent%29)([Intent](/reference/android/content/Intent) 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 (anyone can modify them), and many other problems. The recommended pattern is to use a non-sticky broadcast to report that something has changed, with another mechanism for apps to retrieve the current value whenever desired.

abstract void

[removeStickyBroadcastAsUser](/reference/android/content/Context#removeStickyBroadcastAsUser%28android.content.Intent,%20android.os.UserHandle%29)([Intent](/reference/android/content/Intent) intent, [UserHandle](/reference/android/os/UserHandle) user)

This method was deprecated in API level 21. Sticky broadcasts should not be used. They provide no security (anyone can access them), no protection (anyone can modify them), and many other problems. The recommended pattern is to use a non-sticky broadcast to report that something has changed, with another mechanism for apps to retrieve the current value whenever desired.

void

[revokeSelfPermissionOnKill](/reference/android/content/Context#revokeSelfPermissionOnKill%28java.lang.String%29)([String](/reference/java/lang/String) permName)

Triggers the asynchronous revocation of a runtime permission.

void

[revokeSelfPermissionsOnKill](/reference/android/content/Context#revokeSelfPermissionsOnKill%28java.util.Collection<java.lang.String>%29)([Collection](/reference/java/util/Collection)<[String](/reference/java/lang/String)> permissions)

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

abstract void

[revokeUriPermission](/reference/android/content/Context#revokeUriPermission%28android.net.Uri,%20int%29)([Uri](/reference/android/net/Uri) uri, int modeFlags)

Remove all permissions to access a particular content provider Uri that were previously added with [grantUriPermission(String, Uri, int)](/reference/android/content/Context#grantUriPermission%28java.lang.String,%20android.net.Uri,%20int%29) or any other mechanism.

abstract void

[revokeUriPermission](/reference/android/content/Context#revokeUriPermission%28java.lang.String,%20android.net.Uri,%20int%29)([String](/reference/java/lang/String) toPackage, [Uri](/reference/android/net/Uri) uri, int modeFlags)

Remove permissions to access a particular content provider Uri that were previously added with [grantUriPermission(String, Uri, int)](/reference/android/content/Context#grantUriPermission%28java.lang.String,%20android.net.Uri,%20int%29) for a specific target package.

void

[sendBroadcast](/reference/android/content/Context#sendBroadcast%28android.content.Intent,%20java.lang.String,%20android.os.Bundle%29)([Intent](/reference/android/content/Intent) intent, [String](/reference/java/lang/String) receiverPermission, [Bundle](/reference/android/os/Bundle) options)

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

abstract void

[sendBroadcast](/reference/android/content/Context#sendBroadcast%28android.content.Intent,%20java.lang.String%29)([Intent](/reference/android/content/Intent) intent, [String](/reference/java/lang/String) receiverPermission)

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

abstract void

[sendBroadcast](/reference/android/content/Context#sendBroadcast%28android.content.Intent%29)([Intent](/reference/android/content/Intent) intent)

Broadcast the given intent to all interested BroadcastReceivers.

abstract void

[sendBroadcastAsUser](/reference/android/content/Context#sendBroadcastAsUser%28android.content.Intent,%20android.os.UserHandle%29)([Intent](/reference/android/content/Intent) intent, [UserHandle](/reference/android/os/UserHandle) user)

Version of [sendBroadcast(Intent)](/reference/android/content/Context#sendBroadcast%28android.content.Intent%29) that allows you to specify the user the broadcast will be sent to.

abstract void

[sendBroadcastAsUser](/reference/android/content/Context#sendBroadcastAsUser%28android.content.Intent,%20android.os.UserHandle,%20java.lang.String%29)([Intent](/reference/android/content/Intent) intent, [UserHandle](/reference/android/os/UserHandle) user, [String](/reference/java/lang/String) receiverPermission)

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

void

[sendBroadcastWithMultiplePermissions](/reference/android/content/Context#sendBroadcastWithMultiplePermissions%28android.content.Intent,%20java.lang.String[]%29)([Intent](/reference/android/content/Intent) intent, [String[]](/reference/java/lang/String) receiverPermissions)

Broadcast the given intent to all interested BroadcastReceivers, allowing an array of required permissions to be enforced.

void

[sendOrderedBroadcast](/reference/android/content/Context#sendOrderedBroadcast%28android.content.Intent,%20java.lang.String,%20java.lang.String,%20android.content.BroadcastReceiver,%20android.os.Handler,%20int,%20java.lang.String,%20android.os.Bundle%29)([Intent](/reference/android/content/Intent) intent, [String](/reference/java/lang/String) receiverPermission, [String](/reference/java/lang/String) receiverAppOp, [BroadcastReceiver](/reference/android/content/BroadcastReceiver) resultReceiver, [Handler](/reference/android/os/Handler) scheduler, int initialCode, [String](/reference/java/lang/String) initialData, [Bundle](/reference/android/os/Bundle) initialExtras)

Version of[sendOrderedBroadcast(Intent,String,BroadcastReceiver,Handler,int,String,Bundle)](/reference/android/content/Context#sendOrderedBroadcast%28android.content.Intent,%20java.lang.String,%20android.content.BroadcastReceiver,%20android.os.Handler,%20int,%20java.lang.String,%20android.os.Bundle%29) that allows you to specify the App Op to enforce restrictions on which receivers the broadcast will be sent to.

abstract void

[sendOrderedBroadcast](/reference/android/content/Context#sendOrderedBroadcast%28android.content.Intent,%20java.lang.String,%20android.content.BroadcastReceiver,%20android.os.Handler,%20int,%20java.lang.String,%20android.os.Bundle%29)([Intent](/reference/android/content/Intent) intent, [String](/reference/java/lang/String) receiverPermission, [BroadcastReceiver](/reference/android/content/BroadcastReceiver) resultReceiver, [Handler](/reference/android/os/Handler) scheduler, int initialCode, [String](/reference/java/lang/String) initialData, [Bundle](/reference/android/os/Bundle) initialExtras)

Version of [sendBroadcast(Intent)](/reference/android/content/Context#sendBroadcast%28android.content.Intent%29) that allows you to receive data back from the broadcast.

void

[sendOrderedBroadcast](/reference/android/content/Context#sendOrderedBroadcast%28android.content.Intent,%20java.lang.String,%20android.os.Bundle%29)([Intent](/reference/android/content/Intent) intent, [String](/reference/java/lang/String) receiverPermission, [Bundle](/reference/android/os/Bundle) options)

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

void

[sendOrderedBroadcast](/reference/android/content/Context#sendOrderedBroadcast%28android.content.Intent,%20java.lang.String,%20android.os.Bundle,%20android.content.BroadcastReceiver,%20android.os.Handler,%20int,%20java.lang.String,%20android.os.Bundle%29)([Intent](/reference/android/content/Intent) intent, [String](/reference/java/lang/String) receiverPermission, [Bundle](/reference/android/os/Bundle) options, [BroadcastReceiver](/reference/android/content/BroadcastReceiver) resultReceiver, [Handler](/reference/android/os/Handler) scheduler, int initialCode, [String](/reference/java/lang/String) initialData, [Bundle](/reference/android/os/Bundle) initialExtras)

Version of [sendBroadcast(Intent)](/reference/android/content/Context#sendBroadcast%28android.content.Intent%29) that allows you to receive data back from the broadcast.

abstract void

[sendOrderedBroadcast](/reference/android/content/Context#sendOrderedBroadcast%28android.content.Intent,%20java.lang.String%29)([Intent](/reference/android/content/Intent) intent, [String](/reference/java/lang/String) receiverPermission)

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

abstract void

[sendOrderedBroadcastAsUser](/reference/android/content/Context#sendOrderedBroadcastAsUser%28android.content.Intent,%20android.os.UserHandle,%20java.lang.String,%20android.content.BroadcastReceiver,%20android.os.Handler,%20int,%20java.lang.String,%20android.os.Bundle%29)([Intent](/reference/android/content/Intent) intent, [UserHandle](/reference/android/os/UserHandle) user, [String](/reference/java/lang/String) receiverPermission, [BroadcastReceiver](/reference/android/content/BroadcastReceiver) resultReceiver, [Handler](/reference/android/os/Handler) scheduler, int initialCode, [String](/reference/java/lang/String) initialData, [Bundle](/reference/android/os/Bundle) initialExtras)

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

abstract void

[sendStickyBroadcast](/reference/android/content/Context#sendStickyBroadcast%28android.content.Intent%29)([Intent](/reference/android/content/Intent) 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 (anyone can modify them), and many other problems. The recommended pattern is to use a non-sticky broadcast to report that something has changed, with another mechanism for apps to retrieve the current value whenever desired.

void

[sendStickyBroadcast](/reference/android/content/Context#sendStickyBroadcast%28android.content.Intent,%20android.os.Bundle%29)([Intent](/reference/android/content/Intent) intent, [Bundle](/reference/android/os/Bundle) options)

This method was deprecated in API level 31. Sticky broadcasts should not be used. They provide no security (anyone can access them), no protection (anyone can modify them), and many other problems. The recommended pattern is to use a non-sticky broadcast to report that something has changed, with another mechanism for apps to retrieve the current value whenever desired.

abstract void

[sendStickyBroadcastAsUser](/reference/android/content/Context#sendStickyBroadcastAsUser%28android.content.Intent,%20android.os.UserHandle%29)([Intent](/reference/android/content/Intent) intent, [UserHandle](/reference/android/os/UserHandle) user)

This method was deprecated in API level 21. Sticky broadcasts should not be used. They provide no security (anyone can access them), no protection (anyone can modify them), and many other problems. The recommended pattern is to use a non-sticky broadcast to report that something has changed, with another mechanism for apps to retrieve the current value whenever desired.

abstract void

[sendStickyOrderedBroadcast](/reference/android/content/Context#sendStickyOrderedBroadcast%28android.content.Intent,%20android.content.BroadcastReceiver,%20android.os.Handler,%20int,%20java.lang.String,%20android.os.Bundle%29)([Intent](/reference/android/content/Intent) intent, [BroadcastReceiver](/reference/android/content/BroadcastReceiver) resultReceiver, [Handler](/reference/android/os/Handler) scheduler, int initialCode, [String](/reference/java/lang/String) initialData, [Bundle](/reference/android/os/Bundle) initialExtras)

This method was deprecated in API level 21. Sticky broadcasts should not be used. They provide no security (anyone can access them), no protection (anyone can modify them), and many other problems. The recommended pattern is to use a non-sticky broadcast to report that something has changed, with another mechanism for apps to retrieve the current value whenever desired.

abstract void

[sendStickyOrderedBroadcastAsUser](/reference/android/content/Context#sendStickyOrderedBroadcastAsUser%28android.content.Intent,%20android.os.UserHandle,%20android.content.BroadcastReceiver,%20android.os.Handler,%20int,%20java.lang.String,%20android.os.Bundle%29)([Intent](/reference/android/content/Intent) intent, [UserHandle](/reference/android/os/UserHandle) user, [BroadcastReceiver](/reference/android/content/BroadcastReceiver) resultReceiver, [Handler](/reference/android/os/Handler) scheduler, int initialCode, [String](/reference/java/lang/String) initialData, [Bundle](/reference/android/os/Bundle) initialExtras)

This method was deprecated in API level 21. Sticky broadcasts should not be used. They provide no security (anyone can access them), no protection (anyone can modify them), and many other problems. The recommended pattern is to use a non-sticky broadcast to report that something has changed, with another mechanism for apps to retrieve the current value whenever desired.

abstract void

[setTheme](/reference/android/content/Context#setTheme%28int%29)(int resid)

Set the base theme for this context.

abstract void

[setWallpaper](/reference/android/content/Context#setWallpaper%28android.graphics.Bitmap%29)([Bitmap](/reference/android/graphics/Bitmap) bitmap)

This method was deprecated in API level 15. Use [WallpaperManager.set()](/reference/android/app/WallpaperManager#setBitmap%28android.graphics.Bitmap%29) instead.

This method requires the caller to hold the permission[Manifest.permission.SETWALLPAPER](/reference/android/Manifest.permission#SET%5FWALLPAPER).

abstract void

[setWallpaper](/reference/android/content/Context#setWallpaper%28java.io.InputStream%29)([InputStream](/reference/java/io/InputStream) data)

This method was deprecated in API level 15. Use [WallpaperManager.set()](/reference/android/app/WallpaperManager#setStream%28java.io.InputStream%29) instead.

This method requires the caller to hold the permission[Manifest.permission.SETWALLPAPER](/reference/android/Manifest.permission#SET%5FWALLPAPER).

abstract void

[startActivities](/reference/android/content/Context#startActivities%28android.content.Intent[],%20android.os.Bundle%29)([Intent[]](/reference/android/content/Intent) intents, [Bundle](/reference/android/os/Bundle) options)

Launch multiple new activities.

abstract void

[startActivities](/reference/android/content/Context#startActivities%28android.content.Intent[]%29)([Intent[]](/reference/android/content/Intent) intents)

Same as [startActivities(Intent[],Bundle)](/reference/android/content/Context#startActivities%28android.content.Intent[],%20android.os.Bundle%29) with no options specified.

abstract void

[startActivity](/reference/android/content/Context#startActivity%28android.content.Intent%29)([Intent](/reference/android/content/Intent) intent)

Same as [startActivity(Intent,Bundle)](/reference/android/content/Context#startActivity%28android.content.Intent,%20android.os.Bundle%29) with no options specified.

abstract void

[startActivity](/reference/android/content/Context#startActivity%28android.content.Intent,%20android.os.Bundle%29)([Intent](/reference/android/content/Intent) intent, [Bundle](/reference/android/os/Bundle) options)

Launch a new activity.

abstract[ComponentName](/reference/android/content/ComponentName)

[startForegroundService](/reference/android/content/Context#startForegroundService%28android.content.Intent%29)([Intent](/reference/android/content/Intent) service)

Similar to [startService(Intent)](/reference/android/content/Context#startService%28android.content.Intent%29), but with an implicit promise that the Service will call [startForeground(int, android.app.Notification)](/reference/android/app/Service#startForeground%28int,%20android.app.Notification%29) once it begins running.

abstract boolean

[startInstrumentation](/reference/android/content/Context#startInstrumentation%28android.content.ComponentName,%20java.lang.String,%20android.os.Bundle%29)([ComponentName](/reference/android/content/ComponentName) className, [String](/reference/java/lang/String) profileFile, [Bundle](/reference/android/os/Bundle) arguments)

Start executing an [Instrumentation](/reference/android/app/Instrumentation) class.

abstract void

[startIntentSender](/reference/android/content/Context#startIntentSender%28android.content.IntentSender,%20android.content.Intent,%20int,%20int,%20int%29)([IntentSender](/reference/android/content/IntentSender) intent, [Intent](/reference/android/content/Intent) fillInIntent, int flagsMask, int flagsValues, int extraFlags)

Same as [startIntentSender(IntentSender,Intent,int,int,int,Bundle)](/reference/android/content/Context#startIntentSender%28android.content.IntentSender,%20android.content.Intent,%20int,%20int,%20int,%20android.os.Bundle%29) with no options specified.

abstract void

[startIntentSender](/reference/android/content/Context#startIntentSender%28android.content.IntentSender,%20android.content.Intent,%20int,%20int,%20int,%20android.os.Bundle%29)([IntentSender](/reference/android/content/IntentSender) intent, [Intent](/reference/android/content/Intent) fillInIntent, int flagsMask, int flagsValues, int extraFlags, [Bundle](/reference/android/os/Bundle) options)

Like [startActivity(Intent,Bundle)](/reference/android/content/Context#startActivity%28android.content.Intent,%20android.os.Bundle%29), but taking a IntentSender to start.

abstract[ComponentName](/reference/android/content/ComponentName)

[startService](/reference/android/content/Context#startService%28android.content.Intent%29)([Intent](/reference/android/content/Intent) service)

Request that a given application service be started.

abstract boolean

[stopService](/reference/android/content/Context#stopService%28android.content.Intent%29)([Intent](/reference/android/content/Intent) service)

Request that a given application service be stopped.

abstract void

[unbindService](/reference/android/content/Context#unbindService%28android.content.ServiceConnection%29)([ServiceConnection](/reference/android/content/ServiceConnection) conn)

Disconnect from an application service.

void

[unregisterComponentCallbacks](/reference/android/content/Context#unregisterComponentCallbacks%28android.content.ComponentCallbacks%29)([ComponentCallbacks](/reference/android/content/ComponentCallbacks) callback)

Remove a [ComponentCallbacks](/reference/android/content/ComponentCallbacks) object that was previously registered with [registerComponentCallbacks(ComponentCallbacks)](/reference/android/content/Context#registerComponentCallbacks%28android.content.ComponentCallbacks%29).

void

[unregisterDeviceIdChangeListener](/reference/android/content/Context#unregisterDeviceIdChangeListener%28java.util.function.IntConsumer%29)([IntConsumer](/reference/java/util/function/IntConsumer) listener)

Removes a device ID changed listener from the Context.

abstract void

[unregisterReceiver](/reference/android/content/Context#unregisterReceiver%28android.content.BroadcastReceiver%29)([BroadcastReceiver](/reference/android/content/BroadcastReceiver) receiver)

Unregister a previously registered BroadcastReceiver.

void

[updateServiceBindings](/reference/android/content/Context#updateServiceBindings%28java.util.Collection<android.content.Context.UpdateBindingParams>%29)([Collection](/reference/java/util/Collection)<[Context.UpdateBindingParams](/reference/android/content/Context.UpdateBindingParams)> params)

Perform a batch update of existing bindings.

void

[updateServiceGroup](/reference/android/content/Context#updateServiceGroup%28android.content.ServiceConnection,%20int,%20int%29)([ServiceConnection](/reference/android/content/ServiceConnection) conn, int group, int importance)

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