The following code samples are provided for the M Developer Preview. To download the samples in Android Studio, select the File > Import Samples menu option.

Note: These downloadable projects are designed for use with Gradle and Android Studio.

Runtime Permissions

Android M changes the way system permissions work. Users are asked to approve permission requests at runtime instead of during installation. This sample shows how to request these permissions.

Get it on GitHub

Confirm Credential

This sample demonstrates how to use device credentials as an authentication method in your app.

Get it on GitHub

Fingerprint Dialog

This sample demonstrates how to recognize registered fingerprints to authenticate the user in your app.

Get it on GitHub

Auto Backup for Apps

Android M introduces automatic backup for app settings. This sample demonstrates how to add filtering rules to an app in order to manage settings backup.

Get it on GitHub

Camera 2 Raw

Demonstrates how to use the Camera2 API to capture RAW camera buffers and save them as DNG files.

Get it on GitHub

Active Notification

This sample demonstrates how the NotificationManager can tell you how many notifications your app is currently showing.

Get it on GitHub