# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Methods

# ComponentCallbacks

`public interface ComponentCallbacks`
``

android.content.ComponentCallbacks

Known indirect subclasses AbstractInputMethodService, AccessibilityService, AccountAuthenticatorActivity, Activity, ActivityGroup, AliasActivity, Application, AutofillService, CallRedirectionService, CallScreeningService, CameraPrewarmService, CarrierMessagingClientService, CarrierMessagingService, CarrierService, ChooserTargetService, and 53 others.
AbstractInputMethodService | AbstractInputMethodService provides a abstract base class for input methods.
AccessibilityService | Accessibility services should only be used to assist users with disabilities in using Android devices and apps.
AccountAuthenticatorActivity | This class is deprecated. Applications should extend Activity themselves. This class is not compatible with AppCompat, and the functionality it provides is not complex.
Activity | An activity is a single, focused thing that the user can do.
ActivityGroup | This class is deprecated. Use the new `Fragment` and `FragmentManager` APIs instead; these are also available on older platforms through the Android compatibility package.
AliasActivity | This class is deprecated. Use `<activity-alias>` or subclass Activity directly.
Application | Base class for maintaining global application state.
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.
CallRedirectionService | This service can be implemented to interact between Telecom and its implementor for making outgoing call with optional redirection/cancellation purposes.
CallScreeningService | This service can be implemented by the default dialer (see `TelecomManager#getDefaultDialerPackage()`) or a third party app to allow or disallow incoming calls before they are shown to a user.
CameraPrewarmService | Extend this class to implement a camera prewarm service.
CarrierMessagingClientService | If the default SMS app has a service that extends this class, the system always tries to bind it so that the process is always running, which allows the app to have a persistent connection to the server.
CarrierMessagingService | A service that receives calls from the system when new SMS and MMS are sent or received.
CarrierService | A service that exposes carrier-specific functionality to the system.
ChooserTargetService | This class is deprecated. For publishing direct share targets, please follow the instructions in https://developer.android.com/training/sharing/receive.html#providing-direct-share-targets instead.
CompanionDeviceService | Service to be implemented by apps that manage a companion device.
ComponentCallbacks2 | Extended `ComponentCallbacks` interface with a new callback for finer-grained memory management.
ConditionProviderService | This class is deprecated. Instead of using an automatically bound service, use `NotificationManager.setAutomaticZenRuleState(String, 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 `NotificationManager.ACTION_AUTOMATIC_ZEN_RULE` on your `AutomaticZenRule` via `AutomaticZenRule.setConfigurationActivity(ComponentName)`.
ConnectionService | An abstract service that should be implemented by any apps which either: Can make phone calls (VoIP or otherwise) and want those calls to be integrated into the built-in phone app.
ContentProvider | Content providers are one of the primary building blocks of Android applications, providing content to applications.
ControlsProviderService | Service implementation allowing applications to contribute controls to the System UI.
DeviceAdminService | Base class for a service that device owner/profile owners can optionally have.
DialogFragment | This class is deprecated. Use the Support Library `DialogFragment` for consistent behavior across all devices and access to Lifecycle.
DocumentsProvider | Base class for a document provider.
DreamService | Extend this class to implement a custom dream (available to the user as a "Daydream").
ExpandableListActivity | This class is deprecated. Use `RecyclerView` or use `ExpandableListView` directly
Fragment | This class is deprecated. Use the Jetpack Fragment Library `Fragment` for consistent behavior across all devices and access to Lifecycle.
HostApduService | HostApduService is a convenience `Service` class that can be extended to emulate an NFC card inside an Android service component.
HostNfcFService | HostNfcFService is a convenience `Service` class that can be extended to emulate an NFC-F card inside an Android service component.
InCallService | This service is implemented by an app that wishes to provide functionality for managing phone calls.
InputMethodService | InputMethodService provides a standard implementation of an InputMethod, which final implementations can derive from and customize.
IntentService | This class is deprecated. IntentService is subject to all the background execution limits imposed with Android 8.0 (API level 26). Consider using `WorkManager` or `JobIntentService`, which uses jobs instead of services when running on Android 8.0 or higher.
JobService | Entry point for the callback from the `JobScheduler`.
LauncherActivity | This class is deprecated. Applications can implement this UI themselves using `RecyclerView` and `PackageManager.queryIntentActivities(Intent, int)`
ListActivity | This class is deprecated. Use `ListFragment` or `RecyclerView` to implement your Activity instead.
ListFragment | This class is deprecated. Use the Support Library `ListFragment` for consistent behavior across all devices and access to Lifecycle.
MediaBrowserService | Base class for media browser services.
MediaRoute2ProviderService | Base class for media route provider services.
MediaSession2Service | This API is not generally intended for third party application developers.
MidiDeviceService | A service that implements a virtual MIDI device.
MockApplication | This class is deprecated. Use a mocking framework like Mockito. New tests should be written using the Android Testing Support Library.
MockContentProvider | Mock implementation of ContentProvider.
NativeActivity | Convenience for implementing an activity that will be implemented purely in native code.
NotificationListenerService | A service that receives calls from the system when new notifications are posted or removed, or their ranking changed.
OffHostApduService | OffHostApduService is a convenience `Service` class that can be extended to describe one or more NFC applications that are residing off-host, for example on an embedded secure element or a UICC.
PreferenceActivity | This class is deprecated. Use the AndroidX Preference Library for consistent behavior across all devices. For more information on using the AndroidX Preference Library see Settings.
PreferenceFragment | This class is deprecated. Use the AndroidX Preference Library for consistent behavior across all devices. For more information on using the AndroidX Preference Library see Settings.
PrintService | This is the base class for implementing print services.
QuickAccessWalletService | A `QuickAccessWalletService` provides a list of `WalletCard`s shown in the Quick Access Wallet.
RecognitionService | This class provides a base class for recognition service implementations.
RemoteViewsService | The service to be connected to for a remote adapter to request RemoteViews.
SearchRecentSuggestionsProvider | This superclass can be used to create a simple search suggestions provider for your application.
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 | Dynamically specifies the summary (subtitle) and enabled status of a preference injected into the list of app settings displayed by the system settings app For use only by apps that are included in the system image, for preferences that affect multiple apps.
SliceProvider | A SliceProvider allows an app to provide content to be displayed in system spaces.
SpellCheckerService | SpellCheckerService provides an abstract base class for a spell checker.
TabActivity | This class is deprecated. 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 `Build.VERSION_CODES.DONUT`.
TextToSpeechService | Abstract base class for TTS engine implementations.
TileService | A TileService provides the user a tile that can be added to Quick Settings.
TvInputService | The TvInputService class represents a TV input or source such as HDMI or built-in tuner which provides pass-through video or broadcast TV programs.
VisualVoicemailService | This service is implemented by dialer apps that wishes to handle OMTP or similar visual voicemails.
VoiceInteractionService | Top-level service of the current global voice interactor, which is providing support for hotwording, the back-end of a `VoiceInteractor`, etc.
VoiceInteractionSession | An active voice interaction session, providing a facility for the implementation to interact with the user in the voice interaction layer.
VoiceInteractionSessionService | An active voice interaction session, initiated by a `VoiceInteractionService`.
VpnService | VpnService is a base class for applications to extend and build their own VPN solutions.
VrListenerService | A service that is bound from the system while running in virtual reality (VR) mode.
WallpaperService | A wallpaper service is responsible for showing a live wallpaper behind applications that would like to sit on top of it.
WebViewFragment | This class is deprecated. Manually call `WebView#onPause()` and `WebView#onResume()`

The set of callback APIs that are common to all application components (`Activity`, `Service`, `ContentProvider`, and `Application`).

Note: You should also implement the `ComponentCallbacks2` interface, which provides the `ComponentCallbacks2.onTrimMemory(int)` callback to help your app manage its memory usage more effectively.

## Summary

### Public methods
`abstract void` | `onConfigurationChanged(Configuration newConfig)` Called by the system when the device configuration changes while your component is running.
`abstract void` | `onLowMemory()` This is called when the overall system is running low on memory, and actively running processes should trim their memory usage.

## Public methods

### onConfigurationChanged

    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.

Parameters
`newConfig` | `Configuration`: The new device configuration. This value cannot be `null`.

### onLowMemory

    public abstract void onLowMemory ()

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.

You should implement this method to release any caches or other unnecessary resources you may be holding on to. The system will perform a garbage collection for you after returning from this method.

Preferably, you should implement `ComponentCallbacks2#onTrimMemory` from `ComponentCallbacks2` to incrementally unload your resources based on various levels of memory demands. That API is available for API level 14 and higher, so you should only use this `onLowMemory()` method as a fallback for older versions, which can be treated the same as `ComponentCallbacks2#onTrimMemory` with the `ComponentCallbacks2.TRIM_MEMORY_COMPLETE` level.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*