Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/content/ComponentCallbacks#pubmethods)

# ComponentCallbacks

*** ** * ** ***


`
public


interface
ComponentCallbacks
`


`


`

|---|
| android.content.ComponentCallbacks |

Known indirect subclasses [AbstractInputMethodService](https://developer.android.com/reference/android/inputmethodservice/AbstractInputMethodService), [AccessibilityService](https://developer.android.com/reference/android/accessibilityservice/AccessibilityService), [AccountAuthenticatorActivity](https://developer.android.com/reference/android/accounts/AccountAuthenticatorActivity), [Activity](https://developer.android.com/reference/android/app/Activity), [ActivityGroup](https://developer.android.com/reference/android/app/ActivityGroup), [AliasActivity](https://developer.android.com/reference/android/app/AliasActivity), [AlternativeMessageTransportService](https://developer.android.com/reference/android/service/messaging/AlternativeMessageTransportService), [AppContentProjectionService](https://developer.android.com/reference/android/media/projection/AppContentProjectionService), [AppFunctionService](https://developer.android.com/reference/android/app/appfunctions/AppFunctionService), [Application](https://developer.android.com/reference/android/app/Application), [AutofillService](https://developer.android.com/reference/android/service/autofill/AutofillService), [CallRedirectionService](https://developer.android.com/reference/android/telecom/CallRedirectionService), [CallScreeningService](https://developer.android.com/reference/android/telecom/CallScreeningService), [CameraPrewarmService](https://developer.android.com/reference/android/service/media/CameraPrewarmService), [CarrierMessagingClientService](https://developer.android.com/reference/android/service/carrier/CarrierMessagingClientService), and 67 others. [AbstractInputMethodService](https://developer.android.com/reference/android/inputmethodservice/AbstractInputMethodService) AbstractInputMethodService provides a abstract base class for input methods. [AccessibilityService](https://developer.android.com/reference/android/accessibilityservice/AccessibilityService) Accessibility services should only be used to assist users with disabilities in using Android devices and apps. [AccountAuthenticatorActivity](https://developer.android.com/reference/android/accounts/AccountAuthenticatorActivity) *This class was deprecated
in API level 30.
Applications should extend Activity themselves. This class is not compatible with
AppCompat, and the functionality it provides is not complex.* [Activity](https://developer.android.com/reference/android/app/Activity) An activity is a single, focused thing that the user can do. [ActivityGroup](https://developer.android.com/reference/android/app/ActivityGroup) *This class was deprecated
in API level 13.
Use the new `https://developer.android.com/reference/android/app/Fragment` and `https://developer.android.com/reference/android/app/FragmentManager` APIs
instead; these are also
available on older platforms through the Android compatibility package.* [AliasActivity](https://developer.android.com/reference/android/app/AliasActivity) *This class was deprecated
in API level 30.
Use `<activity-alias>` or subclass Activity directly.* [AlternativeMessageTransportService](https://developer.android.com/reference/android/service/messaging/AlternativeMessageTransportService) AlternativeMessageTransportService (AMTS) allows the default SMS app to handle the sending of a message over a different transport (e.g. RCS etc.) other than the SMS or MMS. [AppContentProjectionService](https://developer.android.com/reference/android/media/projection/AppContentProjectionService) Service to be implemented by the application providing the `https://developer.android.com/reference/android/media/projection/MediaProjectionAppContent`. [AppFunctionService](https://developer.android.com/reference/android/app/appfunctions/AppFunctionService) Extend this class to implement app functions, that can be executed by `https://developer.android.com/reference/android/app/appfunctions/AppFunctionManager#executeAppFunction(android.app.AppInteractionSession,%20android.app.appfunctions.ExecuteAppFunctionRequest,%20java.util.concurrent.Executor,%20android.os.CancellationSignal,%20android.os.OutcomeReceiver<android.app.appfunctions.ExecuteAppFunctionResponse,android.app.appfunctions.AppFunctionException>)`. [Application](https://developer.android.com/reference/android/app/Application) Base class for maintaining global application state. [AutofillService](https://developer.android.com/reference/android/service/autofill/AutofillService) An `AutofillService` is a service used to automatically fill the contents of the screen on behalf of a given user - for more information about autofill, read [Autofill Framework](https://developer.android.com/preview/features/autofill). [CallRedirectionService](https://developer.android.com/reference/android/telecom/CallRedirectionService) This service can be implemented to interact between Telecom and its implementor for making outgoing call with optional redirection/cancellation purposes. [CallScreeningService](https://developer.android.com/reference/android/telecom/CallScreeningService) This service can be implemented by the default dialer (see `https://developer.android.com/reference/android/telecom/TelecomManager#getDefaultDialerPackage()`) or a third party app to allow or disallow incoming calls before they are shown to a user. [CameraPrewarmService](https://developer.android.com/reference/android/service/media/CameraPrewarmService) Extend this class to implement a camera prewarm service. [CarrierMessagingClientService](https://developer.android.com/reference/android/service/carrier/CarrierMessagingClientService) If the default SMS app has a service that extends this class, the system always tries to bind it so that the process is always running, which allows the app to have a persistent connection to the server. [CarrierMessagingService](https://developer.android.com/reference/android/service/carrier/CarrierMessagingService) A service that receives calls from the system when new SMS and MMS are sent or received. [CarrierService](https://developer.android.com/reference/android/service/carrier/CarrierService) A service that exposes carrier-specific functionality to the system. [ChooserTargetService](https://developer.android.com/reference/android/service/chooser/ChooserTargetService) *This class was deprecated
in API level 30.
For publishing direct share targets, please follow the instructions in
https://developer.android.com/training/sharing/receive.html#providing-direct-share-targets
instead.* [CloudMediaProvider](https://developer.android.com/reference/android/provider/CloudMediaProvider) Base class for a cloud media provider. [CompanionDeviceService](https://developer.android.com/reference/android/companion/CompanionDeviceService) A service that receives calls from the system with device events. [ComponentCallbacks2](https://developer.android.com/reference/android/content/ComponentCallbacks2) Callbacks for app state transitions that can be used to improve background memory management. [ConditionProviderService](https://developer.android.com/reference/android/service/notification/ConditionProviderService) *This class was deprecated
in API level 29.
Instead of using an automatically bound service, use
`https://developer.android.com/reference/android/app/NotificationManager#setAutomaticZenRuleState(java.lang.String,%20android.service.notification.Condition)` to tell the
system about the state of your rule. In order to maintain a link from
Settings to your rule configuration screens, provide a configuration activity that handles
`https://developer.android.com/reference/android/app/NotificationManager#ACTION_AUTOMATIC_ZEN_RULE` on your
`https://developer.android.com/reference/android/app/AutomaticZenRule` via
`https://developer.android.com/reference/android/app/AutomaticZenRule#setConfigurationActivity(android.content.ComponentName)`.* [ConnectionService](https://developer.android.com/reference/android/telecom/ConnectionService) An abstract service that should be implemented by any apps which either:

1. Can make phone calls (VoIP or otherwise) and want those calls to be integrated into the built-in phone app.
[ContentProvider](https://developer.android.com/reference/android/content/ContentProvider) Content providers are one of the primary building blocks of Android applications, providing content to applications. [ContentSafetyAppService](https://developer.android.com/reference/android/service/contentsafety/ContentSafetyAppService) Base class for a service that the `android.app.role.RoleManager.ROLE_CONTENT_SAFETY` role holder must implement. [ControlsProviderService](https://developer.android.com/reference/android/service/controls/ControlsProviderService) Service implementation allowing applications to contribute controls to the System UI. [CredentialProviderService](https://developer.android.com/reference/android/service/credentials/CredentialProviderService) Service to be extended by credential providers, in order to return user credentials to the framework. [DataMigrationToPccService](https://developer.android.com/reference/android/app/privatecompute/DataMigrationToPccService) Base class for a service that handles data migration to the Private Compute Core (PCC) storage of an application. [DeviceAdminService](https://developer.android.com/reference/android/app/admin/DeviceAdminService) Base class for a service that device owner/profile owners can optionally have. [DialogFragment](https://developer.android.com/reference/android/app/DialogFragment) *This class was deprecated
in API level 28.
Use the [Support Library](https://developer.android.com/tools/extras/support-library)
`https://developer.android.com/reference/androidx/fragment/app/DialogFragment.html` for consistent behavior across all devices
and access to [Lifecycle](https://developer.android.com/topic/libraries/architecture/lifecycle).* [DocumentsProvider](https://developer.android.com/reference/android/provider/DocumentsProvider) Base class for a document provider. [DreamService](https://developer.android.com/reference/android/service/dreams/DreamService) Extend this class to implement a custom dream (available to the user as a "Daydream"). [EgressReceiverService](https://developer.android.com/reference/android/app/privatecompute/EgressReceiverService) Base Service to be implemented by the partner agent proxy process to receive egress queries from a client running inside the Private Compute Core (PCC) sandbox. [ExpandableListActivity](https://developer.android.com/reference/android/app/ExpandableListActivity) *This class was deprecated
in API level 30.
Use `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.html` or use
`https://developer.android.com/reference/android/widget/ExpandableListView` directly* [Fragment](https://developer.android.com/reference/android/app/Fragment) *This class was deprecated
in API level 28.
Use the [Jetpack Fragment Library](https://developer.android.com/jetpack)
`https://developer.android.com/reference/androidx/fragment/app/Fragment.html` for consistent behavior across all devices
and access to [Lifecycle](https://developer.android.com/topic/libraries/architecture/lifecycle).* [HostApduService](https://developer.android.com/reference/android/nfc/cardemulation/HostApduService) HostApduService is a convenience `https://developer.android.com/reference/android/app/Service` class that can be
extended to emulate an NFC card inside an Android
service component.


[HostNfcFService](https://developer.android.com/reference/android/nfc/cardemulation/HostNfcFService) HostNfcFService is a convenience `https://developer.android.com/reference/android/app/Service` class that can be
extended to emulate an NFC-F card inside an Android service component.


[InCallService](https://developer.android.com/reference/android/telecom/InCallService) This service is implemented by an app that wishes to provide functionality for managing phone calls. [InputMethodService](https://developer.android.com/reference/android/inputmethodservice/InputMethodService) InputMethodService provides a standard implementation of an InputMethod, which final implementations can derive from and customize. [IntentService](https://developer.android.com/reference/android/app/IntentService) *This class was deprecated
in API level 30.
IntentService is subject to all the
[background execution limits](https://developer.android.com/about/versions/oreo/background)
imposed with Android 8.0 (API level 26). Consider using `https://developer.android.com/reference/androidx/work/WorkManager.html`
instead.* [IsolatedService](https://developer.android.com/reference/android/adservices/ondevicepersonalization/IsolatedService) *This class was deprecated
in API level 37.
The ODP APIs are deprecated and will not be supported in future Android releases.
There is no direct replacement API available. Developers currently integrated with these APIs
must cease further integration efforts. For comprehensive details regarding this deprecation and
the future roadmap of Privacy Sandbox on Android, please consult the official Privacy Sandbox
developer documentation and announcements:
<https://privacysandbox.google.com>* [JobService](https://developer.android.com/reference/android/app/job/JobService) Entry point for the callback from the `https://developer.android.com/reference/android/app/job/JobScheduler`.


[LauncherActivity](https://developer.android.com/reference/android/app/LauncherActivity) *This class was deprecated
in API level 30.
Applications can implement this UI themselves using
`https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.html` and
`https://developer.android.com/reference/android/content/pm/PackageManager#queryIntentActivities(android.content.Intent,%20int)`* [ListActivity](https://developer.android.com/reference/android/app/ListActivity) *This class was deprecated
in API level 30.
Use `https://developer.android.com/reference/androidx/fragment/app/ListFragment.html` or
`https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.html` to implement your Activity instead.* [ListFragment](https://developer.android.com/reference/android/app/ListFragment) *This class was deprecated
in API level 28.
Use the [Support Library](https://developer.android.com/tools/extras/support-library)
`https://developer.android.com/reference/androidx/fragment/app/ListFragment.html` for consistent behavior across all devices
and access to [Lifecycle](https://developer.android.com/topic/libraries/architecture/lifecycle).* [MediaBrowserService](https://developer.android.com/reference/android/service/media/MediaBrowserService) Base class for media browser services. [MediaRoute2ProviderService](https://developer.android.com/reference/android/media/MediaRoute2ProviderService) Base class for media route provider services. [MediaSession2Service](https://developer.android.com/reference/android/media/MediaSession2Service) *This class was deprecated
in API level 37.
Use the Media3 support library's `androidx.media3.session.MediaSessionService`
instead.* [MidiDeviceService](https://developer.android.com/reference/android/media/midi/MidiDeviceService) A service that implements a virtual MIDI device. [MidiUmpDeviceService](https://developer.android.com/reference/android/media/midi/MidiUmpDeviceService) A service that implements a virtual MIDI device for Universal MIDI Packets (UMP). [MockApplication](https://developer.android.com/reference/android/test/mock/MockApplication) *This class was deprecated
in API level 24.
Use a mocking framework like [Mockito](https://github.com/mockito/mockito).
New tests should be written using the
[Android Testing Support Library](https://developer.android.com/tools/testing-support-library).* [MockContentProvider](https://developer.android.com/reference/android/test/mock/MockContentProvider) Mock implementation of ContentProvider. [NativeActivity](https://developer.android.com/reference/android/app/NativeActivity) Convenience for implementing an activity that will be implemented purely in native code. [NotificationListenerService](https://developer.android.com/reference/android/service/notification/NotificationListenerService) A service that receives calls from the system when new notifications are posted or removed, or their ranking changed. [OffHostApduService](https://developer.android.com/reference/android/nfc/cardemulation/OffHostApduService) OffHostApduService is a convenience `https://developer.android.com/reference/android/app/Service` class that can be
extended to describe one or more NFC applications that are residing
off-host, for example on an embedded secure element or a UICC.


[PccService](https://developer.android.com/reference/android/app/privatecompute/PccService) Abstract base class for a PCC service that receives data from other components. [PreferenceActivity](https://developer.android.com/reference/android/preference/PreferenceActivity) *This class was deprecated
in API level 29.
Use the [AndroidX](https://developer.android.com/jetpack/androidx)
[Preference Library](https://developer.android.com/reference/androidx/preference/package-summary) for consistent behavior across all devices. For more information on
using the AndroidX Preference Library see
[Settings](https://developer.android.com/guide/topics/ui/settings).* [PreferenceFragment](https://developer.android.com/reference/android/preference/PreferenceFragment) *This class was deprecated
in API level 28.
Use the [AndroidX](https://developer.android.com/jetpack/androidx)
[Preference Library](https://developer.android.com/reference/androidx/preference/package-summary) for consistent behavior across all devices. For more information on
using the AndroidX Preference Library see
[Settings](https://developer.android.com/guide/topics/ui/settings).* [PrintService](https://developer.android.com/reference/android/printservice/PrintService)
This is the base class for implementing print services.


[QuickAccessWalletService](https://developer.android.com/reference/android/service/quickaccesswallet/QuickAccessWalletService) A `QuickAccessWalletService` provides a list of `WalletCard`s shown in the Quick Access Wallet. [RecognitionService](https://developer.android.com/reference/android/speech/RecognitionService) This class provides a base class for recognition service implementations. [RemoteViewsService](https://developer.android.com/reference/android/widget/RemoteViewsService) The service to be connected to for a remote adapter to request RemoteViews. [SearchRecentSuggestionsProvider](https://developer.android.com/reference/android/content/SearchRecentSuggestionsProvider) This superclass can be used to create a simple search suggestions provider for your application. [Service](https://developer.android.com/reference/android/app/Service) A Service is an application component representing either an application's desire to perform a longer-running operation while not interacting with the user or to supply functionality for other applications to use. [SettingInjectorService](https://developer.android.com/reference/android/location/SettingInjectorService) Dynamically specifies the summary (subtitle) and enabled status of a preference injected into the list of app settings displayed by the system settings app

<br />

For use only by apps that are included in the system image, for preferences that affect multiple apps. [SettingsPreferenceService](https://developer.android.com/reference/android/service/settings/preferences/SettingsPreferenceService) Base class for a service that exposes its settings preferences to external access. [SliceProvider](https://developer.android.com/reference/android/app/slice/SliceProvider) *This class was deprecated
in API level 35.
Slice framework has been deprecated, it will not receive any updates from
`https://developer.android.com/` and forward. If you are looking for a
framework that sends displayable data from one app to another, consider using
`https://developer.android.com/reference/android/app/appsearch/AppSearchManager`.* [SpellCheckerService](https://developer.android.com/reference/android/service/textservice/SpellCheckerService) SpellCheckerService provides an abstract base class for a spell checker. [TabActivity](https://developer.android.com/reference/android/app/TabActivity) *This class was deprecated
in API level 13.
New applications should use Fragments instead of this class;
to continue to run on older devices, you can use the v4 support library
which provides a version of the Fragment API that is compatible down to
`https://developer.android.com/reference/android/os/Build.VERSION_CODES#DONUT`.* [TextToSpeechService](https://developer.android.com/reference/android/speech/tts/TextToSpeechService) Abstract base class for TTS engine implementations. [TileService](https://developer.android.com/reference/android/service/quicksettings/TileService) A TileService provides the user a tile that can be added to Quick Settings. [TvAdService](https://developer.android.com/reference/android/media/tv/ad/TvAdService) The TvAdService class represents a TV client-side advertisement service. [TvInputService](https://developer.android.com/reference/android/media/tv/TvInputService) The TvInputService class represents a TV input or source such as HDMI or built-in tuner which provides pass-through video or broadcast TV programs. [TvInteractiveAppService](https://developer.android.com/reference/android/media/tv/interactive/TvInteractiveAppService) A TV interactive application service is a service that provides runtime environment and runs TV interactive applications. [VisualVoicemailService](https://developer.android.com/reference/android/telephony/VisualVoicemailService) This service is implemented by dialer apps that wishes to handle OMTP or similar visual voicemails. [VoiceInteractionService](https://developer.android.com/reference/android/service/voice/VoiceInteractionService) Top-level service of the current global voice interactor, which is providing support for hotwording, the back-end of a `https://developer.android.com/reference/android/app/VoiceInteractor`, etc. [VoiceInteractionSession](https://developer.android.com/reference/android/service/voice/VoiceInteractionSession) An active voice interaction session, providing a facility for the implementation to interact with the user in the voice interaction layer. [VoiceInteractionSessionService](https://developer.android.com/reference/android/service/voice/VoiceInteractionSessionService) An active voice interaction session, initiated by a `https://developer.android.com/reference/android/service/voice/VoiceInteractionService`. [VpnService](https://developer.android.com/reference/android/net/VpnService) VpnService is a base class for applications to extend and build their own VPN solutions. [VrListenerService](https://developer.android.com/reference/android/service/vr/VrListenerService) A service that is bound from the system while running in virtual reality (VR) mode. [WallpaperService](https://developer.android.com/reference/android/service/wallpaper/WallpaperService) A wallpaper service is responsible for showing a live wallpaper behind applications that would like to sit on top of it. [WebViewFragment](https://developer.android.com/reference/android/webkit/WebViewFragment) *This class was deprecated
in API level 28.
Manually call `https://developer.android.com/reference/android/webkit/WebView#onPause()` and `https://developer.android.com/reference/android/webkit/WebView#onResume()`*   

*** ** * ** ***

The set of callback APIs that are common to all application components
(`https://developer.android.com/reference/android/app/Activity`, `https://developer.android.com/reference/android/app/Service`,
`https://developer.android.com/reference/android/content/ContentProvider`, and `https://developer.android.com/reference/android/app/Application`).

**Note:** You should also implement the `https://developer.android.com/reference/android/content/ComponentCallbacks2` interface, which provides the `https://developer.android.com/reference/android/content/ComponentCallbacks2#onTrimMemory(int)` callback to help your app manage its memory usage more
effectively.

<br />

## Summary

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/content/ComponentCallbacks#onConfigurationChanged(android.content.res.Configuration)(https://developer.android.com/reference/android/content/res/Configuration newConfig) ` Called by the system when the device configuration changes while your component is running. |
| ` abstract void` | ` https://developer.android.com/reference/android/content/ComponentCallbacks#onLowMemory()() ` *This method was deprecated in API level 35. Since API level 14 this is superseded by `https://developer.android.com/reference/android/content/ComponentCallbacks2#onTrimMemory(int)`. Since API level 34 this is never called. If you're overriding ComponentCallbacks2#onTrimMemory and your minSdkVersion is greater than API 14, you can provide an empty implementation for this method.* |

## Public methods

### onConfigurationChanged

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onConfigurationChanged (Configuration newConfig)
```

Called by the system when the device configuration changes while your
component is running. Note that, unlike activities, other components
are never restarted when a configuration changes: they must always deal
with the results of the change, such as by re-retrieving resources.

At the time that this function has been called, your Resources
object will have been updated to return resource values matching the
new configuration.

For more information, read [Handling Runtime Changes](https://developer.android.com/guide/topics/resources/runtime-changes).

<br />

| Parameters ||
|---|---|
| `newConfig` | `Configuration`: The new device configuration. This value cannot be `null`. <br /> |

### onLowMemory

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onLowMemory ()
```


**This method was deprecated
in API level 35.**   

Since API level 14 this is superseded by
`https://developer.android.com/reference/android/content/ComponentCallbacks2#onTrimMemory(int)`.
Since API level 34 this is never called.
If you're overriding ComponentCallbacks2#onTrimMemory and
your minSdkVersion is greater than API 14, you can provide
an empty implementation for this method.

This is called when the overall system is running low on memory, and
actively running processes should trim their memory usage. While
the exact point at which this will be called is not defined, generally
it will happen when all background process have been killed.
That is, before reaching the point of killing processes hosting
service and foreground UI that we would like to avoid killing.

<br />