boolean bindIsolatedService(Intent service, int flags, String instanceName, Executor executor, ServiceConnection conn) Variation of bindService(Intent, ServiceConnection, int) that, in the specific case of isolated services, allows the caller to generate multiple instances of a service from a single component declaration.

abstract boolean bindService(Intent service, ServiceConnection conn, int flags) Connect to an application service, creating it if needed.

boolean bindServiceAsUser(Intent service, ServiceConnection conn, int flags, UserHandle user) Binds to a service in the given user in the same manner as bindService(android.content.Intent, android.content.ServiceConnection, int) .

abstract int checkCallingOrSelfPermission(String permission) Determine whether the calling process of an IPC or you have been granted a particular permission.

abstract int checkCallingOrSelfUriPermission(Uri uri, int modeFlags) Determine whether the calling process of an IPC or you has been granted permission to access a specific URI.

abstract int checkCallingPermission(String permission) Determine whether the calling process of an IPC you are handling has been granted a particular permission.

abstract int checkCallingUriPermission(Uri uri, int modeFlags) Determine whether the calling process and user ID has been granted permission to access a specific URI.

abstract int checkPermission(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(String permission) Determine whether you have been granted a particular permission.

abstract int checkUriPermission(Uri uri, String readPermission, String writePermission, int pid, int uid, int modeFlags) Check both a Uri and normal permission.

abstract int checkUriPermission(Uri uri, int pid, int uid, int modeFlags) Determine whether a particular process and user ID has been granted permission to access a specific URI.

abstract void clearWallpaper() This method was deprecated in API level 15. Use WallpaperManager.clear() instead. This method requires the caller to hold the permission Manifest.permission.SET_WALLPAPER .

Context createAttributionContext(String attributionTag) Return a new Context object for the current Context but attribute to a different tag.

abstract Context createConfigurationContext(Configuration overrideConfiguration) Return a new Context object for the current Context but whose resources are adjusted to match the given Configuration.

abstract Context createContextForSplit(String splitName) Return a new Context object for the given split name.

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

abstract Context createDisplayContext(Display display) Return a new Context object for the current Context but whose resources are adjusted to match the metrics of the given Display.

abstract Context createPackageContext(String packageName, int flags) Return a new Context object for the given application name.

Context createWindowContext(int type, Bundle options) Creates a Context for a non-activity window.

abstract String[] databaseList() Returns an array of strings naming the private databases associated with this Context's application package.

abstract boolean deleteDatabase(String name) Delete an existing private SQLiteDatabase associated with this Context's application package.

abstract boolean deleteFile(String name) Delete the given private file associated with this Context's application package.

abstract boolean deleteSharedPreferences(String name) Delete an existing shared preferences file.

abstract void enforceCallingOrSelfPermission(String permission, String message) If neither you nor the calling process of an IPC you are handling has been granted a particular permission, throw a SecurityException .

abstract void enforceCallingOrSelfUriPermission(Uri uri, int modeFlags, String message) If the calling process of an IPC or you has not been granted permission to access a specific URI, throw SecurityException .

abstract void enforceCallingPermission(String permission, String message) If the calling process of an IPC you are handling has not been granted a particular permission, throw a SecurityException .

abstract void enforceCallingUriPermission(Uri uri, int modeFlags, String message) If the calling process and user ID has not been granted permission to access a specific URI, throw SecurityException .

abstract void enforcePermission(String permission, int pid, int uid, String message) If the given permission is not allowed for a particular process and user ID running in the system, throw a SecurityException .

abstract void enforceUriPermission(Uri uri, String readPermission, String writePermission, int pid, int uid, int modeFlags, String message) Enforce both a Uri and normal permission.

abstract void enforceUriPermission(Uri uri, int pid, int uid, int modeFlags, String message) If a particular process and user ID has not been granted permission to access a specific URI, throw SecurityException .

abstract String[] fileList() Returns an array of strings naming the private files associated with this Context's application package.

abstract Context getApplicationContext() Return the context of the single, global Application object of the current process.

abstract ApplicationInfo getApplicationInfo() Return the full application info for this context's package.

abstract AssetManager getAssets() Returns an AssetManager instance for the application's package.

String getAttributionTag() Attribution can be used in complex apps to logically separate parts of the app.

abstract File getCacheDir() Returns the absolute path to the application specific cache directory on the filesystem.

abstract ClassLoader getClassLoader() Return a class loader you can use to retrieve classes in this package.

abstract File getCodeCacheDir() Returns the absolute path to the application specific cache directory on the filesystem designed for storing cached code.

final int getColor(int id) Returns a color associated with a particular resource ID and styled for the current theme.

final ColorStateList getColorStateList(int id) Returns a color state list associated with a particular resource ID and styled for the current theme.

abstract ContentResolver getContentResolver() Return a ContentResolver instance for your application's package.

abstract File getDataDir() Returns the absolute path to the directory on the filesystem where all private files belonging to this app are stored.

abstract File getDatabasePath(String name) Returns the absolute path on the filesystem where a database created with openOrCreateDatabase(String, int, SQLiteDatabase.CursorFactory) is stored.

abstract File getDir(String name, int mode) Retrieve, creating if needed, a new directory in which the application can place its own custom data files.

Display getDisplay() Get the display this context is associated with.

final Drawable getDrawable(int id) Returns a drawable object associated with a particular resource ID and styled for the current theme.

abstract File getExternalCacheDir() 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[] getExternalCacheDirs() Returns absolute paths to application-specific directories on all shared/external storage devices where the application can place cache files it owns.

abstract File getExternalFilesDir(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[] getExternalFilesDirs(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[] getExternalMediaDirs() 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 collection directly, as any app can contribute new media to MediaStore with no permissions required, starting in Build.VERSION_CODES.Q .

abstract File getFileStreamPath(String name) Returns the absolute path on the filesystem where a file created with openFileOutput(String, int) is stored.

abstract File getFilesDir() Returns the absolute path to the directory on the filesystem where files created with openFileOutput(String, int) are stored.

Executor getMainExecutor() Return an Executor that will run enqueued tasks on the main thread associated with this context.

abstract Looper getMainLooper() Return the Looper for the main thread of the current process.

abstract File getNoBackupFilesDir() Returns the absolute path to the directory on the filesystem similar to getFilesDir() .

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

abstract File[] getObbDirs() 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 getOpPackageName() Return the package name that should be used for AppOpsManager calls from this context, so that app ops manager's uid verification will work with the name.

abstract String getPackageCodePath() Return the full path to this context's primary Android package.

abstract PackageManager getPackageManager() Return PackageManager instance to find global package information.

abstract String getPackageName() Return the name of this application's package.

abstract String getPackageResourcePath() Return the full path to this context's primary Android package.

abstract Resources getResources() Returns a Resources instance for the application's package.

abstract SharedPreferences getSharedPreferences(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 getString(int resId, Object... formatArgs) Returns a localized formatted string from the application's package's default string table, substituting the format arguments as defined in Formatter and String.format(String, Object...) .

final String getString(int resId) Returns a localized string from the application's package's default string table.

final <T> T getSystemService(Class<T> serviceClass) Return the handle to a system-level service by class.

abstract Object getSystemService(String name) Return the handle to a system-level service by name.

abstract String getSystemServiceName(Class<?> serviceClass) Gets the name of the system-level service that is represented by the specified class.

final CharSequence getText(int resId) Return a localized, styled CharSequence from the application's package's default string table.

abstract Resources.Theme getTheme() Return the Theme object associated with this Context.

abstract Drawable getWallpaper() This method was deprecated in API level 15. Use WallpaperManager.get() instead.

abstract int getWallpaperDesiredMinimumHeight() This method was deprecated in API level 15. Use WallpaperManager.getDesiredMinimumHeight() instead.

abstract int getWallpaperDesiredMinimumWidth() This method was deprecated in API level 15. Use WallpaperManager.getDesiredMinimumWidth() instead.

abstract void grantUriPermission(String toPackage, 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() Indicates if the storage APIs of this Context are backed by device-protected storage.

boolean isRestricted() Indicates whether this Context is restricted.

abstract boolean moveDatabaseFrom(Context sourceContext, String name) Move an existing database file from the given source storage context to this context.

abstract boolean moveSharedPreferencesFrom(Context sourceContext, String name) Move an existing shared preferences file from the given source storage context to this context.

final TypedArray obtainStyledAttributes(AttributeSet set, int[] attrs) Retrieve styled attribute information in this Context's theme.

final TypedArray obtainStyledAttributes(AttributeSet set, int[] attrs, int defStyleAttr, int defStyleRes) Retrieve styled attribute information in this Context's theme.

final TypedArray obtainStyledAttributes(int resid, int[] attrs) Retrieve styled attribute information in this Context's theme.

final TypedArray obtainStyledAttributes(int[] attrs) Retrieve styled attribute information in this Context's theme.

abstract FileInputStream openFileInput(String name) Open a private file associated with this Context's application package for reading.

abstract FileOutputStream openFileOutput(String name, int mode) Open a private file associated with this Context's application package for writing.

abstract SQLiteDatabase openOrCreateDatabase(String name, int mode, SQLiteDatabase.CursorFactory factory, DatabaseErrorHandler errorHandler) Open a new private SQLiteDatabase associated with this Context's application package.

abstract SQLiteDatabase openOrCreateDatabase(String name, int mode, SQLiteDatabase.CursorFactory factory) Open a new private SQLiteDatabase associated with this Context's application package.

abstract Drawable peekWallpaper() This method was deprecated in API level 15. Use WallpaperManager.peek() instead.

void registerComponentCallbacks(ComponentCallbacks callback) Add a new ComponentCallbacks to the base application of the Context, which will be called at the same times as the ComponentCallbacks methods of activities and other components are called.

abstract Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter) Register a BroadcastReceiver to be run in the main activity thread.

abstract Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter, int flags) Register to receive intent broadcasts, with the receiver optionally being exposed to Instant Apps.

abstract Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter, String broadcastPermission, Handler scheduler, int flags) Register to receive intent broadcasts, to run in the context of scheduler .

abstract Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter, String broadcastPermission, Handler scheduler) Register to receive intent broadcasts, to run in the context of scheduler .

abstract void removeStickyBroadcast(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(Intent intent, 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 revokeUriPermission(Uri uri, int modeFlags) Remove all permissions to access a particular content provider Uri that were previously added with grantUriPermission(String, Uri, int) or any other mechanism.

abstract void revokeUriPermission(String toPackage, Uri uri, int modeFlags) Remove permissions to access a particular content provider Uri that were previously added with grantUriPermission(String, Uri, int) for a specific target package.

abstract void sendBroadcast(Intent intent, String receiverPermission) Broadcast the given intent to all interested BroadcastReceivers, allowing an optional required permission to be enforced.

abstract void sendBroadcast(Intent intent) Broadcast the given intent to all interested BroadcastReceivers.

abstract void sendBroadcastAsUser(Intent intent, UserHandle user) Version of sendBroadcast(android.content.Intent) that allows you to specify the user the broadcast will be sent to.

abstract void sendBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission) Version of sendBroadcast(android.content.Intent, java.lang.String) that allows you to specify the user the broadcast will be sent to.

void sendBroadcastWithMultiplePermissions(Intent intent, String[] receiverPermissions) Broadcast the given intent to all interested BroadcastReceivers, allowing an array of required permissions to be enforced.

abstract void sendOrderedBroadcast(Intent intent, String receiverPermission, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras) Version of sendBroadcast(android.content.Intent) that allows you to receive data back from the broadcast.

abstract void sendOrderedBroadcast(Intent intent, 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 sendStickyBroadcast(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 sendStickyBroadcastAsUser(Intent intent, 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(Intent intent, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, 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(Intent intent, UserHandle user, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, 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(int resid) Set the base theme for this context.

abstract void setWallpaper(Bitmap bitmap) This method was deprecated in API level 15. Use WallpaperManager.set() instead. This method requires the caller to hold the permission Manifest.permission.SET_WALLPAPER .

abstract void setWallpaper(InputStream data) This method was deprecated in API level 15. Use WallpaperManager.set() instead. This method requires the caller to hold the permission Manifest.permission.SET_WALLPAPER .

abstract void startActivities(Intent[] intents, Bundle options) Launch multiple new activities.

abstract void startActivities(Intent[] intents) Same as startActivities(android.content.Intent[], android.os.Bundle) with no options specified.

abstract void startActivity(Intent intent) Same as startActivity(android.content.Intent, android.os.Bundle) with no options specified.

abstract void startActivity(Intent intent, Bundle options) Launch a new activity.

abstract ComponentName startForegroundService(Intent service) Similar to startService(android.content.Intent) , but with an implicit promise that the Service will call startForeground(int, android.app.Notification) once it begins running.

abstract boolean startInstrumentation(ComponentName className, String profileFile, Bundle arguments) Start executing an Instrumentation class.

abstract void startIntentSender(IntentSender intent, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) Like startActivity(android.content.Intent, android.os.Bundle) , but taking a IntentSender to start.

abstract ComponentName startService(Intent service) Request that a given application service be started.

abstract boolean stopService(Intent service) Request that a given application service be stopped.

abstract void unbindService(ServiceConnection conn) Disconnect from an application service.

void unregisterComponentCallbacks(ComponentCallbacks callback) Remove a ComponentCallbacks object that was previously registered with registerComponentCallbacks(android.content.ComponentCallbacks) .

abstract void unregisterReceiver(BroadcastReceiver receiver) Unregister a previously registered BroadcastReceiver.