return new AmbientMode.AmbientCallback() {
public void onEnterAmbient(Bundle ambientDetails) {...}
public void onExitAmbient(Bundle ambientDetails) {...}
}
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# AmbientModeSupport.AmbientCallbackProvider\n\nadded in [version 27.1.0](/topic/libraries/support-library/revisions) \nbelongs to Maven artifact com.android.support:wear:28.0.0-alpha1 \n\nAmbientModeSupport.AmbientCallbackProvider\n==========================================\n\n| This package is part of the Android [support library](/topic/libraries/support-library) which is no longer maintained. The support library has been superseded by [AndroidX](/jetpack/androidx) which is part of [Jetpack](/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider [migrating](/jetpack/androidx/migrate) existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library [class\n| mappings](/jetpack/androidx/migrate/class-mappings).\n\n\n`\npublic\nstatic\n\n\ninterface\nAmbientModeSupport.AmbientCallbackProvider\n`\n\n\n`\n\n\n`\n\n|-------------------------------------------------------------------------|\n| android.support.wear.ambient.AmbientModeSupport.AmbientCallbackProvider |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nInterface for any [Activity](https://developer.android.com/reference/android/app/Activity.html) that wishes to implement Ambient Mode. Use the\n[getAmbientCallback()](/reference/android/support/wear/ambient/AmbientModeSupport.AmbientCallbackProvider#getAmbientCallback()) method to return and [AmbientModeSupport.AmbientCallback](/reference/android/support/wear/ambient/AmbientModeSupport.AmbientCallback) which can be used\nto bind the [AmbientModeSupport](/reference/android/support/wear/ambient/AmbientModeSupport) to the instantiation of this interface.\n\n\n return new AmbientMode.AmbientCallback() {\n public void onEnterAmbient(Bundle ambientDetails) {...}\n public void onExitAmbient(Bundle ambientDetails) {...}\n }\n \n\u003cbr /\u003e\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract `[AmbientModeSupport.AmbientCallback](/reference/android/support/wear/ambient/AmbientModeSupport.AmbientCallback) | ` `[getAmbientCallback](/reference/android/support/wear/ambient/AmbientModeSupport.AmbientCallbackProvider#getAmbientCallback())`() ` |\n\nPublic methods\n--------------\n\n### getAmbientCallback\n\nadded in [version 27.1.0](/topic/libraries/support-library/revisions) \n\n```\nAmbientModeSupport.AmbientCallback getAmbientCallback ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [AmbientModeSupport.AmbientCallback](/reference/android/support/wear/ambient/AmbientModeSupport.AmbientCallback) | the [AmbientModeSupport.AmbientCallback](/reference/android/support/wear/ambient/AmbientModeSupport.AmbientCallback) to be used by this class to communicate with the entity interested in ambient events. \u003cbr /\u003e |\n\n-\n\n Interfaces\n ----------\n\n - [AmbientMode.AmbientCallbackProvider](/reference/android/support/wear/ambient/AmbientMode.AmbientCallbackProvider)\n - [AmbientModeSupport.AmbientCallbackProvider](/reference/android/support/wear/ambient/AmbientModeSupport.AmbientCallbackProvider)\n-\n\n Classes\n -------\n\n - [AmbientMode](/reference/android/support/wear/ambient/AmbientMode)\n - [AmbientMode.AmbientCallback](/reference/android/support/wear/ambient/AmbientMode.AmbientCallback)\n - [AmbientMode.AmbientController](/reference/android/support/wear/ambient/AmbientMode.AmbientController)\n - [AmbientModeSupport](/reference/android/support/wear/ambient/AmbientModeSupport)\n - [AmbientModeSupport.AmbientCallback](/reference/android/support/wear/ambient/AmbientModeSupport.AmbientCallback)\n - [AmbientModeSupport.AmbientController](/reference/android/support/wear/ambient/AmbientModeSupport.AmbientController)"]]