Here you'll find Android samples aggregated from various official sources. If you'd like to see a particular sample, do let us know in the wishlist page. You may want to visit our tutorials section where we show how to build pro Android apps.

Android Samples

easypermissionsgooglesamples
android-instant-apps/hello-feature-modulegooglesamples
android-instant-apps/multi-feature-modulegooglesamples
android-instant-apps/cookie-apigooglesamples
android-instant-apps/hello-javagooglesamples
android-instant-apps/analyticsgooglesamples
android-instant-apps/flavorsgooglesamples
android-instant-apps/hello-kotlingooglesamples
android-instant-apps/servicegooglesamples
android-instant-apps/configuration-apksgooglesamples
android-instant-apps/install-apigooglesamples
android-instant-apps/storage-apigooglesamples
android-AutofillFrameworkgooglesamples
android-AutofillFramework/kotlinAppgooglesamples
android-WatchFacegooglesamples
android-testing/integration/ServiceTestRuleSamplegooglesamples
android-testing/runner/AndroidJunitRunnerSamplegooglesamples
android-testing/ui/espresso/BasicSamplegooglesamples
android-testing/ui/espresso/CustomMatcherSamplegooglesamples
android-testing/ui/espresso/DataAdapterSamplegooglesamples
android-testing/ui/espresso/IdlingResourceSamplegooglesamples
android-testing/ui/espresso/IntentsAdvancedSamplegooglesamples
android-testing/ui/espresso/IntentsBasicSamplegooglesamples
android-testing/ui/espresso/MultiWindowSamplegooglesamples
android-testing/ui/espresso/RecyclerViewSamplegooglesamples
android-testing/ui/espresso/WebBasicSamplegooglesamples
android-testing/ui/uiautomator/BasicSamplegooglesamples
android-testing/unit/BasicSamplegooglesamples
android-testing/unit/BasicUnitAndroidTestgooglesamples
android-testing/ui/espresso/MultiProcessSamplegooglesamples
android-vision/visionSamples/FaceTrackergooglesamples
android-vision/visionSamples/barcode-readergooglesamples
android-vision/visionSamples/multi-trackergooglesamples
android-vision/visionSamples/photo-demogooglesamples
android-vision/visionSamples/googly-eyesgooglesamples
android-vision/visionSamples/ocr-codelab/ocr-reader-completegooglesamples
android-vision/visionSamples/ocr-codelab/ocr-reader-startgooglesamples
android-vision/visionSamples/ocr-readergooglesamples
android-UniversalMusicPlayergooglesamples
android-play-safetynet/client/java/SafetyNetSamplegooglesamples
android-play-safetynet/server/javagooglesamples
android-architecture-components/BasicSamplegooglesamples
android-architecture-components/GithubBrowserSamplegooglesamples
android-architecture-components/PersistenceContentProviderSamplegooglesamples
android-architecture-components/BasicRxJavaSamplegooglesamples
android-architecture-components/PersistenceMigrationsSamplegooglesamples
android-architecture-components/BasicRxJavaSampleKotlingooglesamples
android-architecture-components/PagingSamplegooglesamples
android-play-location/ActivityRecognitiongooglesamples
android-play-location/BasicLocationSamplegooglesamples
android-play-location/Geofencinggooglesamples
android-play-location/LocationAddressgooglesamples
android-play-location/LocationUpdatesgooglesamples
android-play-location/LocationUpdatesForegroundServicegooglesamples
android-play-location/LocationUpdatesPendingIntentgooglesamples
android-play-locationgooglesamples
android-fit/BasicHistoryApigooglesamples
android-fit/BasicHistorySessionsgooglesamples
android-fit/BasicRecordingApigooglesamples
android-fit/BasicSensorsApigooglesamples
android-fit/StepCountergooglesamples
android-nearby/messages/NearbyBackgroundBeaconsgooglesamples
android-nearby/messages/NearbyDevicesgooglesamples
android-nearby/connections/walkietalkiegooglesamples
android-Camera2Basicgooglesamples
android-play-places/PlaceCompleteActivitygooglesamples
android-play-places/PlaceCompleteAdaptergooglesamples
android-play-places/PlaceCompleteFragmentgooglesamples
android-play-places/PlacePickergooglesamples
android-play-billing/TrivialDrivegooglesamples
android-play-billing/TrivialDrive_v2googlesamples
android-RuntimePermissionsgooglesamples
android-RuntimePermissions/kotlinAppgooglesamples
android-BluetoothChatgooglesamples
android-FingerprintDialoggooglesamples
android-Camera2Videogooglesamples
android-testdpcgooglesamples
android-testing-templates/AndroidTestingBlueprintgooglesamples
android-unsplashgooglesamples
android-BluetoothLeGattgooglesamples
android-ads/admob/BannerExamplegooglesamples
android-ads/admob/InterstitialExamplegooglesamples
android-ads/admob/NativeAdvancedExamplegooglesamples
android-ads/admob/NativeExpressExamplegooglesamples
android-ads/advanced/APIDemogooglesamples
android-ads/advanced/NativeExpressRecyclerViewExamplegooglesamples
android-ads/advanced/NativeListViewExamplegooglesamples
android-ads/doubleclick/BannerExamplegooglesamples
android-ads/doubleclick/CustomRenderingExamplegooglesamples
android-ads/doubleclick/InterstitialExamplegooglesamples
android-ads/admob/RewardedVideoExamplegooglesamples
android-PictureInPicturegooglesamples
android-PictureInPicture/kotlinAppgooglesamples
android-Geofencinggooglesamples
android-Notificationsgooglesamples
android-ScreenCapturegooglesamples
android-RecyclerViewgooglesamples
android-credentials/credentials-quickstartgooglesamples
android-credentials/credentials-signingooglesamples
android-credentials/sms-verification/androidgooglesamples
android-JobSchedulergooglesamples
android-MultiWindowPlaygroundgooglesamples
android-XYZTouristAttractionsgooglesamples
android-Timergooglesamples
android-PdfRendererBasicgooglesamples
android-NavigationDrawergooglesamples
android-CardViewgooglesamples
android-ConstraintLayoutExamplesgooglesamples
android-Quizgooglesamples
android-EmojiCompatgooglesamples
android-EmojiCompat/kotlinAppgooglesamples
android-MessagingServicegooglesamples
android-MediaRecordergooglesamples
android-DisplayingBitmapsgooglesamples
android-LNotificationsgooglesamples
android-MediaBrowserServicegooglesamples
android-Camera2Rawgooglesamples
android-Interpolatorgooglesamples
android-ActiveNotificationsgooglesamples
android-BasicAndroidKeyStoregooglesamples
android-BasicSyncAdaptergooglesamples
android-SlidingTabsBasicgooglesamples
android-gcmnetworkmanagergooglesamples
android-NotificationChannelsgooglesamples
android-NotificationChannels/kotlinAppgooglesamples
android-NetworkConnectgooglesamples
android-BluetoothAdvertisementsgooglesamples
android-SpeedTrackergooglesamples
android-SlidingTabsColorsgooglesamples
android-AsymmetricFingerprintDialoggooglesamples
android-OurStreetsgooglesamples
android-AppUsageStatisticsgooglesamples
android-DirectBootgooglesamples
android-CustomNotificationsgooglesamples
android-SynchronizedNotificationsgooglesamples
android-custom-lint-rules/android-studio-2googlesamples
android-custom-lint-rules/android-studio-3googlesamples
android-Flashlightgooglesamples
android-TextSwitchergooglesamples
android-RevealEffectBasicgooglesamples
android-ConfirmCredentialgooglesamples
android-ScopedDirectoryAccessgooglesamples
android-BasicManagedProfilegooglesamples
android-DownloadableFontsgooglesamples
android-DownloadableFonts/kotlinAppgooglesamples
android-AppShortcutsgooglesamples
android-RepeatingAlarmgooglesamples
android-TextLinkifygooglesamples
android-BasicNotificationsgooglesamples
android-SwipeRefreshMultipleViewsgooglesamples
android-BasicGestureDetectgooglesamples
android-ActivitySceneTransitionBasicgooglesamples
android-NfcProvisioninggooglesamples
android-MediaEffectsgooglesamples
android-BasicNetworkinggooglesamples
android-FloatingActionButtonBasicgooglesamples
android-SwipeRefreshListFragmentgooglesamples
android-StorageProvidergooglesamples
android-CardEmulationgooglesamples
android-DeviceOwnergooglesamples
androidtv-sample-inputsgooglesamples
android-CardReadergooglesamples
android-BatchStepSensorgooglesamples
android-DirectSharegooglesamples
android-FindMyPhonegooglesamples
android-ElevationDraggooglesamples
android-codelab-watchfacegooglesamples
android-HdrViewfindergooglesamples
android-GridViewPagergooglesamples
android-AccelerometerPlaygooglesamples
android-BasicMediaDecodergooglesamples
android-play-games-in-motiongooglesamples
android-RuntimePermissionsBasicgooglesamples
android-HorizontalPaginggooglesamples
android-PermissionRequestgooglesamples
android-DirectorySelectiongooglesamples
android-CustomTransitiongooglesamples
android-ActionBarCompat-ShareActionProvidergooglesamples
android-SkeletonWearableAppgooglesamples
android-StorageClientgooglesamples
android-google-accounts/AutoManagegooglesamples
android-google-accounts/QuickStartgooglesamples
android-BasicAccessibilitygooglesamples
android-WatchViewStubgooglesamples
android-ElevationBasicgooglesamples
android-CustomChoiceListgooglesamples
android-SwipeRefreshLayoutBasicgooglesamples
android-ClippingBasicgooglesamples
android-BasicMultitouchgooglesamples
android-RecipeAssistantgooglesamples
android-BeamLargeFilesgooglesamples
android-BorderlessButtonsgooglesamples
android-BasicTransitiongooglesamples
android-RenderScriptIntrinsicgooglesamples
android-ActionBarCompat-Styledgooglesamples
android-DoneBargooglesamples
android-DocumentCentricAppsgooglesamples
android-BasicContactablesgooglesamples
android-MidiSynthgooglesamples
android-ActionBarCompat-Basicgooglesamples
android-BasicRenderScriptgooglesamples
android-media-controllergooglesamples
android-WearSpeakerSamplegooglesamples
google-services/android/analyticsgooglesamples
google-services/android/gcmgooglesamples
google-services/android/signingooglesamples
android-JumpingJackgooglesamples
android-DataLayergooglesamples
android-WearCompanionLibrarygooglesamples
android-DrawableTintinggooglesamples
android-MediaRoutergooglesamples
android-AppRestrictionEnforcergooglesamples
android-ElizaChatgooglesamples
android-AutoBackupForAppsgooglesamples
android-WearDrawersgooglesamples
android-AdvancedImmersiveModegooglesamples
android-AppRestrictionSchemagooglesamples
android-play-awareness/basic-awareness-samplegooglesamples
android-SimpleMediaPlayergooglesamples
android-ImmersiveModegooglesamples
android-ActivityInstrumentationgooglesamples
android-MidiScopegooglesamples
android-BasicMediaRoutergooglesamples
android-BasicImmersiveModegooglesamples
android-RuntimePermissionsWeargooglesamples
android-fidogooglesamples
android-AgendaDatagooglesamples
android-ActionBarCompat-ListPopupMenugooglesamples
android-AppRestrictionsgooglesamples
android-WearNotificationsgooglesamples
android-AlwaysOngooglesamples
androidtv-GameControllergooglesamples
android-DelayedConfirmationgooglesamples
android-WclDemoSamplegooglesamples
android-WearVerifyRemoteAppgooglesamples
androidtv-VisualGameControllergooglesamples
android-CommitContentSampleIMEgooglesamples
android-ContentProviderPaginggooglesamples
android-ContentProviderPaging/kotlinAppgooglesamples
android-WearHighBandwidthNetworkinggooglesamples
leanback-showcasegooglesamples
android-DragAndDropAcrossAppsgooglesamples
android-CommitContentSampleAppgooglesamples
android-WearOAuthgooglesamples
android-WearComplicationProvidersTestSuitegooglesamples
android-DocumentCentricRelinquishIdentitygooglesamples
android-WearStandaloneGoogleSignIngooglesamples
android-key-attestation/servergooglesamples
android-ShareActionProvidergooglesamples
leanback-assistantgooglesamples
leanback-homescreen-channelsgooglesamples

EasyPermissions

EasyPermissions is a wrapper library to simplify basic system permissions logic when targeting Android M or higher.

Browse source

Android Instant Apps - Feature Module sample

This sample introduces feature modules to the Hello World sample.

Browse source

Android Instant Apps - Multi feature sample app

This sample app demonstrates building an installable and an instant app with the same behaviors. The functionality of the instant app is split in two features, which can be individually launched on a device.

Browse source

Android Instant Apps - Cookie API Sample

This sample app demonstrates how to use the Cookie API.

Browse source

Android Instant Apps - Hello World

This sample app demonstrates how to build an installed and an instant app with the same behaviors using the Java Programming Language.

Browse source

Android Instant Apps - Google Analytics Example

This sample app demonstrates how to integrate Google Analytics for Firebase into an instant app.

Browse source

Android Instant Apps - Flavors Sample

This sample introduces the usage of product flavors within an Instant App.

Browse source

Android Instant Apps - Hello World (Kotlin)

This sample app demonstrates how to build an installed and an instant app with the same behaviors by using Kotlin. The functionality of the instant app is built in two features, which can be individually installed and launched on a device.

Browse source

Android Instant Apps - Service Sample

This sample demonstrates how to create a started or a bound service within Android Instant Apps.

Browse source

Android Instant Apps - Configuration APKs Sample

This sample displays the usage of Configuration APKs within gradle.

Browse source

Android Instant Apps - Install API sample

This sample app demonstrates how to use the Install API.

Browse source

Android Instant Apps - Storage API sample

This sample app demonstrates how to use the Storage API.

Browse source

Android AutofillFramework Sample

This sample demonstrates the use of the Autofill Framework. It includes implementations of client Activities with views that should be autofilled, and a Service that can provide autofill data to client Activities.

Browse source

Android AutofillFramework Sample

This sample demonstrates the use of the Autofill Framework. It includes implementations of client Activities with views that should be autofilled, and a Service that can provide autofill data to client Activities.

Browse source

Android WatchFace Sample

A simple sample that demonstrates watch faces and complications for Wear 2.0.

Browse source

Basic sample for ServiceTestRule

This rule provides a simplified mechanism to start and shutdown your service before and after the duration of your test. It also guarantees that the service is successfully connected when starting (or binding to) a service. The service can be started (or bound) using one of the helper methods. It will automatically be stopped (or unbound) after the test completes and any methods annotated with @After are finished.

Browse source

AndroidJUnitRunner sample

The new android test runner brings Junit4 support to android testing. This samples gives a quick overview of some of the new features like test annotations, parameterized tests and test suite creation.

Browse source

Basic sample for Espresso

If you are new to Espresso, try this sample first.

Browse source

Custom matchers sample for Espresso

Extending Espresso is easy! This sample shows how to match the "hint" property of an EditText.

Browse source

Data Adapter sample for Espresso

An AdapterView (like ListView, GridView, etc.) is a view bound to an Adapter that determines the view's children. In Espresso, you can match these children views using the onData() method instead of onView() as you would do normally. Instead of matching views, onData() matches the data that is bound to each view item.

Browse source

Basic Idling Resource sample for Espresso

The centerpiece of Espresso is its ability to seamlessly synchronize all test operations with the application under test. By default, Espresso waits for UI events in the current message queue to be processed and default AsyncTasks* to complete before it moves on to the next test operation. This should address the majority of application/test synchronization in your application.

Browse source

Advanced sample for Espresso Intents

Espresso Intents is a great way to do hermetic inter app testing. It works essentially like mockito and allows for Intent verification and stubbing. This sample shows how to stub an Intent and simulate that a picture is fetched from the camera without leaving the main app.

Browse source

Basic sample for Espresso Intents

Espresso Intents is a great way to do hermetic inter app testing. It works essentially like mockito and allows for Intent verification and stubbing.

Browse source

Multi-window sample for Espresso

Android's Window system allows multiple view hierarchies to layer on top of each other.

Browse source

RecyclerView sample for Espresso

Espresso has a special entry point to interact with AdapterViews, onData(), however, RecyclerViews work differently than AdapterViews.

Browse source

Basic sample for Espresso Web

Espresso Web is an API that can be used to write automated tests for hybrid applications which contain one or more WebViews. Similar to onData, WebView interactions are actually composed of several ViewActions, however ViewActions in Espresso Web are composed of Web Driver Atoms. Espresso Web takes care of synchronization and tries to minimize boilerplate to a bare minimum, while still giving you an Espresso-like feel to interacting with WebViews.

Browse source

Basic sample for UiAutomator

If you are new to UiAutomator, try this sample first.

Browse source

Basic sample for writing unit tests that mocks the Android framework

If you are new to unit testing on Android, try this sample first.

Browse source

Basic sample for unit testing on device or emulator

An Unit Android Test is a test that needs an Android device or emulator but it's different from a UI test because it doesn't start any activities.

Browse source

Multiprocess Espresso Sample

To test app components in a non-default processes, you can use the functionality of Multiprocess Espresso. This tool, available on Android O (API level 26) and higher, allows you to seamlessly test your app's UI interactions that cross your app's process boundaries while maintaining Espresso's synchronization guarantees.

Browse source

android-vision/visionSamples/FaceTracker

Sample code for the Android Mobile Vision API.

Browse source

android-vision/visionSamples/barcode-reader

Sample code for the Android Mobile Vision API.

Browse source

android-vision/visionSamples/multi-tracker

Sample code for the Android Mobile Vision API.

Browse source

android-vision/visionSamples/photo-demo

Sample code for the Android Mobile Vision API.

Browse source

android-vision/visionSamples/googly-eyes

Sample code for the Android Mobile Vision API.

Browse source

android-vision/visionSamples/ocr-codelab/ocr-reader-complete

Sample code for the Android Mobile Vision API.

Browse source

android-vision/visionSamples/ocr-codelab/ocr-reader-start

Sample code for the Android Mobile Vision API.

Browse source

android-vision/visionSamples/ocr-reader

Sample code for the Android Mobile Vision API.

Browse source

Universal Android Music Player Sample

This sample shows how to implement an audio media app that works across multiple form factors and provide a consistent user experience on Android phones, tablets, Android Auto, Android Wear, Android TV and Google Cast devices.

Browse source

Java Android SafetyNet Sample

This sample demonstrates the SafetyNet API in Google Play Services. This API tests whether the device and software have passed Android compatibility testing. Use the option in the toolbar to make an API request. The next step is to read and verify the result of the compatibility check. This should be done on the server side as shown in the 'server' component of this sample. You can share the result of the API call from this app and use it as input into samples for the server component.

Browse source

Java Server SafetyNet Samples

This sample demonstrates how to verify the response received from the SafetyNet service.

Browse source

Android Architecture Components Basic Sample

This sample showcases the following Architecture Components:

Browse source

Github Browser Sample with Android Architecture Components

This is a sample app that uses Android Architecture Components with Dagger 2.

Browse source

Room with Content Providers Sample

This sample demonstrates how to expose data stored in the Room persistence library with Android's Content Provider framework.

Browse source

Room & RxJava Sample

This is an API sample to showcase how to implement observable queries in Room, with RxJava's Flowable objects.

Browse source

Room Migration Sample

This is an API sample to showcase how to deal with database migrations using Room. From docs:

Browse source

Room & RxJava (Kotlin) Sample

This is an API sample to showcase how to use Room, with RxJava's Flowable objects in Kotlin.

Browse source

Android Architecture Components Paging Sample

This sample showcases the following Architecture Components:

Browse source

Recognizing the User's Current Activity

Demonstrates use of the ActivityRecognitionApi to recognize a user's current activity, such as walking, driving, or standing still.

Browse source

Basic Location Sample

Demonstrates use of the Google Play services Location API to retrieve the last known location for a device.

Browse source

Creating and Monitoring Geofences

Demonstrates how to create and remove geofences using the GeofencingApi. Monitor geofence transitions and creates notifications whenever a device enters or exits a geofence.

Browse source

Location Updates

Demonstrates how to use the Geocode API and reverse geocoding to display a device's location as an address.

Browse source

Location Updates

Demonstrates how to use the Fused Location Provider API to get updates about a device's location. The Fused Location Provider is part of the Google Play services Location APIs.

Browse source

android-play-location/LocationUpdatesForegroundService

null

Browse source

android-play-location/LocationUpdatesPendingIntent

null

Browse source

Google Play Location Samples

Samples that use Location APIs to help you make your applications location aware.

Browse source

Android Fit History Api Sample

A simple example of how to use the History API on the Android Fit platform.

Browse source

Android Fit History Api Sessions Sample

A simple example of how to use sessions with the History API on the Android Fit platform.

Browse source

Android Fit Recording Api Sessions Sample

A simple example of how to use the Recording API on the Android Fit platform.

Browse source

Android Fit Sensors Api Sample

A simple example of how to use the Sensors API on the Android Fit platform.

Browse source

Step Counter

A simple example of how to record steps and read them back.

Browse source

Google APIs for Mobile: Quickstarts

Demonstrates use of long-lived background subscription with the Nearby.Messages API to scan for beacons using Bluetooth Low Energy (BLE).

Browse source

Google APIs for Mobile: Quickstarts

Demonstrates use of the Nearby.Messages API for communicating between devices within close proximity of each other.

Browse source

Google APIs for Mobile: Quickstarts

Demonstrates streaming audio with the Nearby.Connections API to other nearby devices.

Browse source

Android Camera2Basic Sample

This sample demonstrates how to use basic functionalities of Camera2 API. You can learn how to iterate through characteristics of all the cameras attached to the device, display a camera preview, and take pictures.

Browse source

Android PlaceCompleteActivity Sample

This sample uses the PlaceAutocomplete Activity from the Places API for Android to open a fullscreen autocomplete widget when the button is pressed.

Browse source

Android PlaceCompleteAdapter Sample

This sample uses the Google Places Geo Data API for Android to provide autocomplete suggestions. It shows how to use a custom Adapter to display suggestions in an AutocompleteTextView. Once selected, details about a place are retrieved based on its Place id from the Places Geo Data API.

Browse source

Android PlaceCompleteFragment Sample

This sample uses the PlaceAutocompleteFragment from the Places API for Android within a CardView to provide an autocomplete powered search experience. Once a place is selected, its details are displayed.

Browse source

Android PlacePicker Sample

This sample uses the PlacePicker.Builder to construct an Intent to launch the place picker dialog. Users can select a place or add a new place, which is then returned to the application.

Browse source

Trivial Drive

Sample for In-App Billing version 3

Browse source

Trivial Drive v2

Sample for In-App Billing version 3

Browse source

Android RuntimePermissions Sample

This sample shows runtime permissions available in Android M and above. It shows how to check and request permissions at runtime, handle backwards compatibility using the support library and how to declare optional permissions for M-devices only.

Browse source

android-RuntimePermissions/kotlinApp

null

Browse source

Android BluetoothChat Sample

This sample shows how to implement two-way text chat over Bluetooth between two Android devices, using all the fundamental Bluetooth API capabilities.

Browse source

Android FingerprintDialog Sample

A sample that demonstrates to use registered fingerprints to authenticate the user in your app

Browse source

Android Camera2Video Sample

This sample shows how to record video using the new Camera2 API in Android Lollipop.

Browse source

Test Device Policy Control (Test DPC) App

Test DPC is an app designed to help EMMs, ISVs, and OEMs to test their applications and platforms in a Android for Work managed profile (i.e. work profile). It serves as both a sample Device Policy Controller and a testing application to flex the APIs available for Android for Work. It supports devices running Android 5.0 Lollipop or later. As of Mar 24, 2017, it also includes support for devices running API level 26.

Browse source

Android Testing Blueprint

A collection of Google's Android testing tools and frameworks, all integrated in a single application project.

Browse source

null

Code used within the example section of the #io16 session "A window into transitions".

Browse source

Android BluetoothLeGatt Sample

This sample demonstrates how to use the Bluetooth LE Generic Attribute Profile (GATT) to transmit arbitrary data between devices.

Browse source

AdMob Banner Sample

This sample demonstrates how to request and display an AdMob banner ad in an Android application. The app contains a single, "Hello World" activity with a banner at the bottom of its layout.

Browse source

AdMob Interstitial Sample

This sample demonstrates how to request and display an AdMob interstitial ad in an Android application. The code illustrates how to instantiate an InterstitialAd object, preload an interstitial, and then display it.

Browse source

AdMob Native Advanced Sample

This sample demonstrates how to request and display an ad from AdMob Native Ads Advanced in an Android application. The app displays an ad at the top of its activity, and offers a few checkboxes and a button you can use to request different native ad formats.

Browse source

AdMob Native Ads Express Sample

This sample demonstrates how to request and display an ad from AdMob Native Ads Express in an Android application. The app loads and displays a single ad at the bottom of its activity.

Browse source

Advanced API Demos for Android

This is an advanced example application that covers a number of features in the AdMob and DoubleClick For Publishers APIs. It uses methods provided by the Mobile Ads SDK for targeting, sizing, exclusions, custom events, and more.

Browse source

Native Ads Express RecyclerView Sample

This sample demonstrates how to request and display ads from AdMob Native Ads Express in an Android application using the RecyclerView widget.

Browse source

DoubleClick For Publishers Advanced Native Example

This project is an advanced native ads example intended to show how publishers might construct a list-based user experience (such as a news feed might have) that incorporates multiple native ad formats.

Browse source

DoubleClick Banner Sample

This sample demonstrates how to request and display a DoubleClick For Publishers banner ad in an Android application. The app contains a single, "Hello World" activity with a banner at the bottom of its layout.

Browse source

DoubleClick Custom Rendering Sample

This sample demonstrates how to request and display an ad from DoubleClick for Publishers Custom Rendering in an Android application. The app displays an ad at the top of its activity, and offers a few checkboxes and a button you can use to request different native ad formats.

Browse source

DoubleClick Interstitial Sample

This sample demonstrates how to request and display a DoubleClick For Publishers interstitial ad in an Android application. The code illustrates how to instantiate a PublisherInterstitialAd object, preload an interstitial, and then display it.

Browse source

android-ads/admob/RewardedVideoExample

null

Browse source

Android PictureInPicture Sample

This sample demonstrates basic usage of Picture-in-Picture mode for handheld devices. The sample plays a video. The video keeps on playing when the app is turned in to Picture-in-Picture mode. On Picture-in-Picture screen, the app shows an action item to pause or resume the video.

Browse source

Android PictureInPicture Sample (Kotlin)

This sample demonstrates basic usage of Picture-in-Picture mode for handheld devices. The sample plays a video. The video keeps on playing when the app is turned in to Picture-in-Picture mode. On Picture-in-Picture screen, the app shows an action item to pause or resume the video.

Browse source

Android Geofencing Sample

When the user enters the vicinity of the Android building (B44) or the Yerba Buena Gardens near the Moscone center in San Francisco, a notification silently appears on their wearable with an option to check in. This notification automatically disappears when they leave the area, and reappears the next time they are at one of these locations.

Browse source

Android Notifications Sample

This sample showcases the available notification styles on a device and wearable.

Browse source

Android ScreenCapture Sample

This sample demonstrates how to use Media Projection API to capture device screen in real time and show it on a SurfaceView.

Browse source

Android RecyclerView Sample

Sample demonstrating the use of RecyclerView to layout elements with a LinearLayoutManager and with a GridLayoutManager. It also demonstrates how to handle touch events on elements.

Browse source

credentials-quickstart

This is a quickstart sample for the Android Credentials API, which is part of Smartlock for Passwords on Android. Visit the following link for more information:

Browse source

Credentials API + Google Sign In API Quickstart

This sample demonstrates how to use both the Credentials API (SmartLock for Passwords) and the Google Sign In API in the same application.

Browse source

SMS Verify App

This sample demonstrates the use of Play Service's SMS Verification APIs to get access to specially-tagged text messages (the tags associate the message with the APK) without needing full SMS retrieval permission (SMS_READ).

Browse source

Android JobScheduler Sample

Demonstration of the JobScheduler API, which provides an interface for scheduling background tasks when certain tasks apply.

Browse source

Android MultiWindowPlayground Sample

This sample demonstrates the use of the multi-window API available in Android N. It shows the use of new Intent flags and AndroidManifest properties to define the multi-window behavior. Switch the sample app into multi-window mode to see how it affects the lifecycle and behavior of the app.

Browse source

Android XYZTouristAttractions Sample

This sample aims to be as close to a real world example of a mobile and Wear app combination as possible. It has a more refined design and also provides a practical example of how a mobile app would interact and communicate with its wear counterpart.

Browse source

Android Timer Sample

This simple wearable app allows the user to set a countdown timer. It runs independently on the wearable with no phone connection.

Browse source

Android PdfRendererBasic Sample

This sample demonstrates how to display PDF document on screen using the PdfRenderer introduced in Android 5.0 Lollipop.

Browse source

Android Navigation Drawer Sample

This example illustrates a common usage of the DrawerLayout widget in the Android support library.

Browse source

Android CardView Sample Sample

This sample demonstrates how to use CardView introduced in the support library in Android 5.0.

Browse source

Constraint Layout Samples

This repository contains a list of layouts that showcases the various features and usage of ConstraintLayout

Browse source

Android Quiz Sample

This sample uses Google Play Services Wearable Data APIs to communicate between applications on a phone and a paired wearable device. Users can create quiz questions on the phone, each of which has an associated DataItem. These DataItems are then received on the wearable, which displays them as notifications. Each notification contains the question as the first page, followed by answers as actions. When an answer is selected, the corresponding question's DataItem is updated, which allows the phone application to update the status of the question (i.e. did the user answer it correctly or not) and prompt the next question.

Browse source

Android EmojiCompat Sample

This sample demonstrates usage of EmojiCompat support library. You can use this library to prevent your app from showing missing emoji characters in the form of tofu (□). You can use either bundled or downloadable emoji fonts. This sample shows both usages.

Browse source

Android EmojiCompat Sample (Kotlin)

This sample demonstrates usage of EmojiCompat support library. You can use this library to prevent your app from showing missing emoji characters in the form of tofu (□). You can use either bundled or downloadable emoji fonts. This sample shows both usages.

Browse source

Android MessagingService Sample

This sample shows a simple service that sends notifications using NotificationCompat. It also extends the notification with Remote Input to allow Android N devices to reply via text directly from the notification without having to open an App. The same Remote Input object also allows Android Auto users to respond by voice when the notification is presented there. Note: Each unread conversation from a user is sent as a distinct notification.

Browse source

Android MediaRecorder Sample

This sample uses the camera/camcorder as the A/V source for the MediaRecorder API. A TextureView is used as the camera preview which limits the code to API 14+. This can be easily replaced with a SurfaceView to run on older devices.

Browse source

Android DisplayingBitmaps Sample

Sample demonstrating how to load large bitmaps efficiently off the main UI thread, caching bitmaps (both in memory and on disk), managing bitmap memory and displaying bitmaps in UI elements such as ViewPager and ListView/GridView.

Browse source

Android LNotifications Sample Sample

This sample demonstrates new features for notifications introduced in Android L. These features include heads-up notifications, visibility, people, category and priority metadata.

Browse source

Android MediaBrowserService Sample

This sample shows how to implement a media app that allows background playback of audio, and provide a media library that is exposed to other apps.

Browse source

Android Camera2Raw Sample

This sample demonstrates using the Camera2 API to capture a JPEG and RAW sensor frame. Check the source code to see a typical example of how to display the camera preview; run auto-focus, auto-exposure metering, and auto-white-balance; capture a JPEG and RAW image for the same sensor frame; and save these into MediaStore for use in other applications.

Browse source

Android Interpolator Sample

This sample demonstrates the use of animation interpolators and path animations for Material Design.

Browse source

Android ActiveNotifications Sample

Notification Groups and the Notification Manager can be used together to simplify how users experience notifications. This sample demonstrates how the NotificationManager can tell you how many notifications your application is currently showing. It also shows how to manage the notifications as a group and introduce a summary for the group, when supported by the platform.

Browse source

Android BasicAndroidKeyStore Sample

An advanced sample displaying the creation and usage of data integrity mechanisms

Browse source

Android BasicSyncAdapter Sample

This sample demonstrates using SyncAdapter to fetch background data for an app. It covers the creation of the required Service that the OS uses to initiate the background data sync as well as scheduling syncs with background data.

Browse source

Android SlidingTabsBasic Sample

A basic sample which shows how to use SlidingTabLayout to display a custom ViewPager title strip which gives continuous feedback to the user when scrolling.

Browse source

GcmNetworkManager Quickstart

This sample demonstrates how to use the GcmNetworkManager API.

Browse source

Android NotificationChannels Sample

Demonstration of using channels to categorize notifications by topic. This feature was added in Android O, and allows users to have fine-grained control over their notification preferences.

Browse source

Android NotificationChannels Sample (Kotlin)

Demonstration of using channels to categorize notifications by topic. This feature was added in Android O, and allows users to have fine-grained control over their notification preferences.

Browse source

Android NetworkConnect Sample

This sample demonstrates how to connect to the network and fetch raw HTML using HttpsURLConnection. AsyncTask is used to perform the fetch on a background thread.

Browse source

Android BluetoothAdvertisements Sample

Sample demonstrating how to advertise small amounts of data using the Bluetooth Low Energy API. Also demonstrates how to scan for those Advertisements. (requires 2 devices to see full operation)

Browse source

Android SpeedTracker Sample

Sample demonstrates recording location and speed with a Wear device in mind. Location is retrieved via FusedLocatinProvider which retrieves coordinates from the phone or Wear depending on whether the phone is disconnected or not and whether the Wear device has a GPS chip.

Browse source

Android SlidingTabsColors Sample

A more advanced sample which shows how to use SlidingTabLayout to display a custom ViewPager title strip, with custom coloring for each tab.

Browse source

Android AsymmetricFingerprintDialog Sample

A sample that demonstrates to use registered fingerprints to authenticate the user in your app

Browse source

OurStreets for Android

Visit StreetView galleries with delightful material design aspects.

Browse source

Android AppUsageStatistics Sample

A basic app showing how to use App usage statistics API to let users collect statistics related to usage of the applications.

Browse source

Android DirectBoot Sample

Sample demonstrating how to store data in a device protected storage which is always available while the device is booted both before and after any user credentials(PIN/Pattern/Password) are entered.

Browse source

Android CustomNotifications Sample

This sample demonstrates notifications with custom content views. The use of collapsed and expanded notification views are shown.

Browse source

Android SynchronizedNotifications Sample

A basic sample showing how to use simple or synchronized notifications. This allows users to dismiss events from either their phone or wearable device simultaneously.

Browse source

null

See README.md in the parent directory for general information.

Browse source

Sample Lint Checks

This project shows how Android Studio 3 (beta 5 and later) handles packaging of lint rules.

Browse source

Android Flashlight Sample

Sample demonstrating the use of an Activity in a wearable application. The sample uses the screen as a flashlight.

Browse source

Android TextSwitcher Sample

This sample illustrates the use of a TextSwitcher to display animations for text changes.

Browse source

Android RevealEffectBasic Sample

Sample demonstrating circular reveal effect. It covers creating an Animator with ViewAnimationUtils as well as defining the parameters of the circular reveal including starting position and radius.

Browse source

Android Confirm Credential Sample

A sample that demonstrates how to use device credentials (PIN, Pattern, Password) in your app

Browse source

Android ScopedDirectoryAccess Sample

This sample demonstrates how to use the Scoped Directory Access API introduced in Android N to easily access to specific directories such as Pictures, Downloads instead of requesting READ_EXTERNAL_STORAGE or WRITE_EXTERNAL_STORAGE in your manifest.

Browse source

Android BasicManagedProfile Sample

This sample demonstrates basic functionalities of Managed Profile API introduced in Android 5.0 Lollipop. You can set up this app as a profile owner, and use this app to enable/disable apps in the newly created managed profile. You can also set restrictions to some apps, enable/disable Intent forwarding between profiles, and wipe out all the data associated with the profile.

Browse source

Android DownloadableFonts Sample

This sample demonstrates how to use the Downloadable Fonts feature introduced in Android O. Downloadable Fonts is a feature that allows apps to request a certain font from a provider instead of bundling it or downloading it themselves. This means, there is no need to bundle the font as an asset.

Browse source

Android DownloadableFonts Sample (Kotlin)

This sample demonstrates how to use the Downloadable Fonts feature introduced in Android O. Downloadable Fonts is a feature that allows apps to request a certain font from a provider instead of bundling it or downloading it themselves. This means, there is no need to bundle the font as an asset.

Browse source

Android AppShortcuts Sample

This sample demonstrates how to use the Launcher Shortcuts API introduced in Android 7.1 (API 25). This API allows an application to define a set of Intents which are displayed as when a user long-presses on the app's launcher icon. Examples are given for registering both links both statically in XML, as well as dynamically at runtime.

Browse source

Android RepeatingAlarm Sample

Introductory text that explains what the sample is intended to demonstrate. Edit in template-params.xml.

Browse source

Android TextLinkify Sample

This sample illustrates how links can be added to a TextView. This can be done either automatically by setting the "autoLink" property or explicitly.

Browse source

Android BasicNotifications Sample

A basic app showing how to display events in the system's notification bar using the NotificationCompat API. NotificationCompat API is used for compatibility with older devices, running Android 1.6 (Donut) (API level 4) or newer.

Browse source

Android SwipeRefreshMultipleViews Sample

A sample which shows how to use SwipeRefreshLayout to add the 'swipe-to-refresh' gesture to a layout with multiple children, enabling the ability to trigger a refresh from swiping down on the visible view. In this sample, SwipeRefreshLayout contains a scrollable GridView, along with a TextView empty view.

Browse source

Android BasicGestureDetect Sample

This sample detects gestures on a view and logs them. In order to try this sample out, try dragging or tapping the text.

Browse source

Android ActivitySceneTransitionBasic Sample

This sample shows how to use scene transitions from one Activity to another in Lollipop. Uses a combination of changeImageTransform and changeBounds to transition a grid of images to an Activity with a large image and detail text.

Browse source

Android NfcProvisioning Sample

This sample demonstrates how to use NFC to provision a new device with a device owner. Device owner is a specialized type of device administrator that can control device security and configuration. This sample itself is not a device owner, but it is a programming app that sends NFC message to an unprovisioned peer device and tells it to set up the specified device owner app.

Browse source

Android MediaEffects Sample

This sample shows how to use the Media Effects APIs that were introduced in Android 4.0.

Browse source

Android BasicNetworking Sample

This sample demonstrates how to check network connectivity with Android APIs.

Browse source

Android FloatingActionButtonBasic Sample

This sample shows the two sizes of Floating Action Buttons and how to interact with them.

Browse source

Android SwipeRefreshListFragment Sample

A sample which shows how to use SwipeRefreshLayout to add 'swipe-to-refresh' gesture to a ListView, enabling the ability to trigger a refresh from swiping down on that view.

Browse source

Android StorageProvider Sample

This sample shows how to implement a simple documents provider using the storage access framework available in Android 4.4.

Browse source

Android CardEmulation Sample

This sample demonstrates how to emulate an NFC card, using the "host card emulation" feature added in Android 4.4. This sample makes the device appear as a loyalty card whenever the screen is on and the user taps their device on an appropriately configured NFC reader.

Browse source

Android DeviceOwner Sample

This sample demonstrates how to use some device owner features. As a device owner, you can configure global settings such as automatic time and timezone. You can mandate a specific launcher by preferred intent handler.

Browse source

Sample Android TV Channel App (TV Input) using TIF

This app is designed to show how to build live TV channel apps for Android TV using the TV Input Framework (TIF). The sample is a service that once installed, is recognized and run by the default TV app (e.g. Live Channels app).

Browse source

Android CardReader Sample

This sample demonstrates how to implement a low-level NFC card reader, for reading cards that do not contain NDEF or Android Beam data. This sample is designed to read the virtual loyalty card implemented in the "CardEmulation" sample.

Browse source

Android BatchStepSensor Sample

Sample demonstrating how to set up SensorEventListeners for step detectors and step counters.

Browse source

Android DirectShare Sample

Sample demonstrating how to show some options directly in the list of share intent candidates.

Browse source

Android FindMyPhone Sample

This sample application notifies you when you may have left your phone behind (specifically, when your companion and wearable disconnect). If you have misplaced your phone, but it is still connected to your wearable, you can also start an activity on the wearable to sound an alarm on your phone.

Browse source

Android ElevationDrag Sample

This sample demonstrates a drag and drop action on different shapes. Elevation and z-translation are used to render the shadows and the views are clipped using different Outlines.

Browse source

Android Wear watch face codelab

In this codelab you'll learn how to create an analog watch face and customize it to our needs, keeping best practices for the platform in mind.

Browse source

Android HdrViewfinder Sample

This demo implements a real-time high-dynamic-range camera viewfinder, by alternating the sensor's exposure time between two exposure values on even and odd frames, and then compositing together the latest two frames whenever a new frame is captured.

Browse source

Android GridViewPager Sample

Demonstrates how to implement a GridViewPager in your wearable app.

Browse source

Android AccelerometerPlay Sample

Sample demonstrating how to use an accelerometer sensor as input for a physics-based view.

Browse source

Android BasicMediaDecoder Sample

This sample shows how to use the MediaCoder to decode a video, use a TimeAnimator to sync the rendering commands with the system display frame rendering and finally render it to a TextureView.

Browse source

android-play-games-in-motion

null

Browse source

Android RuntimePermissionsBasic Sample

This basic sample shows runtime permissions available in the Android M and above. It shows how to use the new runtime permissions API to check and request permissions through the support library.

Browse source

Android HorizontalPaging Sample

This sample shows how to implement tabs, using Fragments and a ViewPager.

Browse source

Android PermissionRequest Sample

This sample demonstrates how to use the PermissionRequest API to securely provide access to restricted system features (such as a camera or microphone) from within a WebView. In this example, a dialog is created to allow users to explicitly approve or reject each request.

Browse source

Android DirectorySelection Sample

A basic app showing how to use Directory Selection API to let users select an entire directory subtree, which extends the Storage Access Framework introduced in Android 4.4 (API level 19).

Browse source

Android CustomTransition Sample

This sample shows how to implement a custom Transition extending the standard Transition class.

Browse source

Android ActionBarCompat-ShareActionProvider Sample

This sample shows you how a provide a context-sensitive ShareActionProvider with ActionBarCompat, backwards compatible to API v7.

Browse source

Android SkeletonWearableApp Sample

This sample is a basic skeleton app which can be used as a starting point for wear development.

Browse source

Android StorageClient Sample

Using the OPEN_DOCUMENT intent, a client app can access a list of Document Providers on the device, and choose a file from any of them.

Browse source

android-google-accounts/AutoManage

null

Browse source

android-google-accounts/QuickStart

null

Browse source

Android BasicAccessibility Sample

This sample demonstrates how to create an accessible application, using a mix of different widgets demonstrating different ways of adding accessibility markup to a UI.

Browse source

Android WatchViewStub Sample

This sample demonstrates how to specify different layouts for round and rectangular screens.

Browse source

Android ElevationBasic Sample

This sample demonstrates ways to move a view in the z-axis using setTranslationZ(). This method was introduced in API Level 21 ('Lollipop').

Browse source

Android CustomChoiceList Sample

This sample demonstrates how to create custom checkable layouts, for use with ListView's choiceMode attribute.

Browse source

Android SwipeRefreshLayoutBasic Sample

A basic sample which shows how to use SwipeRefreshLayout to add the 'swipe-to-refresh' gesture to a View, enabling the ability to trigger a refresh from swiping down on the view. In this sample the View which can be refreshed is a ListView.

Browse source

Android ClippingBasic Sample

A basic app showing how to clip on a View using ViewOutlineProvider interface, by which a View builds its outline, used for shadowing and clipping.

Browse source

Android BasicMultitouch Sample

Sample demonstrates the use of MotionEvent properties to keep track of individual touches across multiple touch events.

Browse source

Android RecipeAssistant Sample

This phone application uses the enhanced notifications API to display recipe instructions using paged notifications. After starting the application on your phone, you can browse from a short list of recipes and select one to view. Each recipe is broken down into a number of steps; when ready, you can click on the START action in the action bar to send the steps to the wearable. On the wearable device, the steps are displayed as a multi-page notification, with one page for each step in the recipe.

Browse source

Android BeamLargeFiles Sample

This sample demonstrates how to transfer large files via Android Beam. After the initial handshake over NFC, file transfer will take place over a secondary high-speed communication channel such as Bluetooth or WiFi Direct.

Browse source

Android BorderlessButtons Sample

This sample demonstrates the borderless button styling from the Holo visual language. Styling is applied in the XML resource layout definitions, referecing the styling attributes from the Holo theme.

Browse source

Android BasicTransition Sample

A basic app showing how to use the Transition framework introduced in KitKat. The app shows radioboxes to select between different Scenes, and uses various ways to transition between them.

Browse source

Android RenderScriptIntrinsic Sample

RenderScriptIntrinsic sample that demonstrates how to use RenderScript intrinsics. Creates several RenderScript intrinsics and shows a filtering result with various parameters. Also shows how to extends RedioButton with StateListDrawable.

Browse source

Android ActionBarCompat-Styled Sample

This sample shows you how to use ActionBarCompat with a customized theme. It utilizes a split action bar when running on a device with a narrow display, and shows three tabs.

Browse source

Android DoneBar Sample

This sample shows how to create a custom view in the ActionBar to show a done button, using 2 alternative layouts. This is well suited for simple data entry activities, where the only options for the user are to cancel or confirm the data changes.

Browse source

Android DocumentCentricRecents Sample

Sample demonstrating the basic usage of the new 'Document Centric Apps' API. It let's you create new documents in the system overview menu and persists its state through reboots.

Browse source

Android BasicContactables Sample

This sample shows how to search for contacts, displaying a SearchView in the Action Bar for user input and implementing a query Cursor with CommonDataKinds.Contactables.

Browse source

Android MidiSynth Sample

Sample demonstrating how to use the MIDI API to receive and play MIDI messages coming from an attached input device (MIDI keyboard).

Browse source

Android ActionBarCompat-Basic Sample

This sample shows you how to use ActionBarCompat to create a basic Activity which displays action items. It covers inflating items from a menu resource, as well as adding an item in code.

Browse source

Android BasicRenderScript Sample

This sample demonstrates using RenderScript to perform basic image manipulation. Specifically, it allows users to dynamically adjust the saturation for an image using a slider. A custom RenderScript kernel performs the saturation adjustment, running the computation on the device's GPU or other compute hardware as deemed appropriate by the system.

Browse source

Media Controller Test

Create a simple MediaController that connects to a MediaBrowserService in order to test inter-app media controls.

Browse source

Android WearSpeakerSample Sample

A sample that shows how you can record voice using the microphone on a wearable and play the recorded voice or an mp3 file, if the wearable device has a built-in speaker.

Browse source

Google Analytics Quickstart

Google Analytics Android Quickstart app demonstrates collecting app usage analytics via Tracker available in Google Play Services. HitBuilders.ScreenViewBuilder is used to send screen view analytics.

Browse source

Google Cloud Messaging Quickstart

Google Cloud Messaging Android Quickstart app demonstrates registering an Android app for GCM and handling the receipt of a GCM message. InstanceID allows easy registration while GcmReceiver and GcmListenerService provide simple means of receiving and handling messages.

Browse source

Google Sign-In Quickstart

The Google Sign-In Android quickstart demonstrates how to authenticate a user with GoogleSignInClient.

Browse source

Android JumpingJack Sample

A basic sample showing how to use the Gravity sensor on the wearable device by counting how many jumping jacks you have performed.

Browse source

Android DataLayer Sample

This sample demonstrates how to work with a WearableListenerService, to produce and consume DataEvents and effectively work with the DataLayer.

Browse source

WearCompanionLibrary (WCL)

This is an evolving library to help Wear developers with those tasks that they need to deal with often. Features provided in this library will change over time while backward compatibility will be maintained as much as possible. This library can be added to your project as a module and can be used on your wear or mobile modules, as an added dependency (for certain features, it needs to be added to both).

Browse source

Android DrawableTinting Sample

Sample that shows applying tinting and color filters to Drawables both programmatically and as Drawable resources in XML.

Browse source

Android MediaRouter Sample

Demonstrates how to create a custom media route provider.

Browse source

Android AppRestrictionEnforcer Sample

This sample demonstrates how to set restrictions to other apps as a profile owner. Use the AppRestrictionSchema sample to set restrictions.

Browse source

Android ElizaChat Sample

A basic sample showing how to add extensions to notifications on wearable using NotificationCompat.WearableExtender API by providing a chat experience.

Browse source

Android Automatic Backup Sample

Sample demonstrating how to selectively disable Automatic Backups in Android M, either by adjusting the location where data files are stored or by using a custom XML configuration file.

Browse source

Android WearDrawers Sample

A simple sample that demonstrates Navigation and Action Drawers, part of Material Design for Wear.

Browse source

Android AdvancedImmersiveMode Sample

Immersive Mode, added in Android 4.4, improves the "hide full screen" and "hide nav bar" modes by letting users swipe the bars in and out. This sample lets the user experiment with immersive mode by seeing how it interacts with some of the other UI flags related to full-screen apps.

Browse source

Android AppRestrictionSchema Sample

A basic app showing how to allow a device administrator to restrict user activities using the Android Device Administration API. The app exports a custom policy that enables or disables a UI control. Device Administration applications are able to enforce a specific value for this policy, as directed by enterprise administrators.

Browse source

android-play-awareness/basic-awareness-sample

null

Browse source

Simple MediaPlayer Sample

This sample demonstrates the use of MediaPlayer. Here are some important things this sample highlights:

Browse source

Android ImmersiveMode Sample

One of the features introduced in KitKat is "immersive mode". Immersive mode gives the user the ability to show/hide the status bar and navigation bar with a swipe.To try, click the "Toggle immersive mode" button, then try swiping the bar in and out!

Browse source

Android ActivityInstrumentation Sample

This sample provides a basic example of using an InstrumentationTest to probe the internal state of an Activity.

Browse source

Android MidiScope Sample

Sample demonstrating how to use the MIDI API to receive and process MIDI signals coming from an attached device.

Browse source

Android BasicMediaRouter Sample

This sample demonstrates the use of the MediaRouter API to display content on a secondary display. Use the "Media Route Action Item" in the ActionBar to select an output device. If your device supports Miracast wireless displays, you may need to enable "Wireless Display" functionality in the system settings. Secondary screen simulation can also be enabled from the "Developer Options".

Browse source

Android BasicImmersiveMode Sample

Sample demonstrating the use of immersive mode to hide the system and navigation bars for full screen applications.

Browse source

Android RuntimePermissionsWear Sample

A sample that shows how you can handle remote data that requires permissions both on a wearable device and a mobile device.

Browse source

Android FIDO U2F API Sample

A basic app showing how to register and authenticate FIDO U2F Security Keys using the FIDO U2F API.

Browse source

Android AgendaData Sample

Sample demonstrating sync of calendar events to a wearable by the press of a button.

Browse source

Android ActionBarCompat-ListPopupMenu Sample

This sample shows how to display a pop up menu using PopupMenu from the v7 appcompat library.

Browse source

Android AppRestrictions Sample

A sample that demonstrates the use of the App Restriction feature on devices with multiuser support

Browse source

Android WearNotifications Sample

Sample demonstrates best practices for using NotificationStyle Notifications (Inbox, BigPicture, BigText, and Messaging) for both Mobile apps and native/local Android Wear apps. It also covers Notifications on Wear 1.+ and Wear 2.0.

Browse source

Android AlwaysOn Sample

A basic sample showing how to support ambient mode for native Android Wear apps.

Browse source

androidtv-GameController

null

Browse source

Android DelayedConfirmation Sample

Demonstrates how to create a DelayedConfirmationView in your wearable app. In this sample, pressing a button on the phone app sends a message to the wearable to start a simple activity. This activity displays a DelayedConfirmationView that starts when the user presses "Start Timer." Then, callbacks are implemented on both the wearable and phone to show when the timer is selected or finishes. The activity on the wearable uses BoxInsetLayout to automatically apply appropriate margins based on whether the display is square or circular.

Browse source

WclDemoSample

This is a sample app that shows how one can set up an application to use the WearCompanionLibrary. It has both a phone and a wear component. On your mobile, select a page from the drawer and there, you can open the corresponding page on your wear device by pressing on the FAB button at the lower right corner of the page. On your wear device, you can select an item form the list when you run the app. Features shown here include exchanging data, launching remote app, making HTTP calls from the wear device, showing variations of WearableListView activities and recording voice on the wear and streaming that to the mobile device and playing it there in real-time. In order for each feature to work properly, you have to be on that feature's page on both the mobile app and the wear app at the same time.

Browse source

Android WearVerifyRemoteApp Sample

Sample demonstrates best practices for checking if connected mobile device has your app installed from an Android Wear 2.+ standalone app and the other way around.

Browse source

VisualGameController

The Visual Game Controller app is designed to run on an Android TV device and displays visual feedback for the buttons of an attached game controller.

Browse source

Android CommitContentSampleIME Sample

This sample demonstrates how to write an keyboard which sends rich content (such as images) to text fields using the Commit Content API.

Browse source

Android ContentProviderPaging Sample

This sample demonstrates how to use the ContentProvider with paging support introduced in Android O. The ContentProvider now accepts additional arguments for the offset and the limit in the query method to support paging instead of fetching all the data in a single query method call.

Browse source

Android ContentProviderPaging Sample (Kotlin)

This sample demonstrates how to use the ContentProvider with paging support introduced in Android O. The ContentProvider now accepts additional arguments for the offset and the limit in the query method to support paging instead of fetching all the data in a single query method call.

Browse source

Android WearHighBandwidthNetworking Sample

Sample demonstrates how to determine if a high-bandwidth network is available for use cases that require a minimum network bandwidth, such as streaming media or downloading large files. In addition, the sample demonstrates best practices for asking a user to add a new Wi-Fi network for high-bandwidth network operations if the bandwidth of currently available networks is inadequate.

Browse source

Leanback Support Library Showcase App for Android TV

This sample app showcases different components that come with Leanback library.

Browse source

Android DragAndDropAcrossApps-new Sample

This sample contains two separate Android applications: DragSource and DropTarget. DragSource contains images and text that can be dropped into the DropTarget app. Images are shared between the two apps through a URI for which the receiving app must request permission first, before it can be used.

Browse source

Android CommitContentSampleApp Sample

This sample demonstrates how to write an application which accepts rich content (such as images) sent from a keyboard using the Commit Content API.

Browse source

Android Wear OAuth Sample

Sample demonstrating OAuth authentication on Wear 2.0.

Browse source

Android WearComplicationProvidersTestSuite Sample

Complication Test Suite is a set of complication providers that provide dummy data and it can be used to test how different types of complications render on a watch face.

Browse source

Android DocumentCentricRelinquishIdentity Sample

This sample shows how to relinquish identity to activities above it in the task stack.

Browse source

Android Wear Google Sign-In Sample

Sample demonstrating Google Sign-In implementation on Wear 2.0, as well as a Google Sign-In button matching Wear material design.

Browse source

Android Key Attestation Sample

This sample illustrates how to use the Bouncy Castle ASN.1 parser to extract information from an Android attestation data structure to verify that a key pair has been generated in an Android device. This sample demonstrates how to verify a certificate on a server.

Browse source

Android ShareActionProvider Sample

This sample shows you how a provide a context-sensitive ShareActionProvider.

Browse source

Assistant on Android TV sample

This sample is designed to run on an Android TV device that supports the assistant (such as the NVIDIA SHIELD). It demonstrates how to interact with the user through the assistant to control playback.

Browse source

Android TV Home Screen Channel / Programs Sample

This sample is designed to run on an Android TV device that run Android Oreo (API 26) or higher. It demonstrates how to interact with the home screen to add channels and programs to increase user engagement.

Browse source