# android/platform-samples ships isolated demos, not a starter app

> android/platform-samples is Google's Kotlin sample collection for individual Android platform APIs, arranged as one folder per topic under samples/. The app module that ties them together is explicitly described as disposable, and the code is explicitly not production ready.

**android/platform-samples** — A collection of samples of different Android OS platform APIs.

- Repository: https://github.com/android/platform-samples
- Website: https://developer.android.com/about
- Stars: 1,763 · Forks: 552
- Language: Kotlin
- License: Apache-2.0
- Published: 2026-10-16 · Updated: 2026-10-16 · Language: en
- Canonical page: https://hysenlabs.com/projects/android-platform-samples

## One folder per platform topic, each with its own README

The repository is organised as a directory tree under samples/, with one folder per topic area. The README links eight of them directly: Accessibility, Camera, Connectivity, Graphics, Location, Privacy, Storage and User-interface, and notes that more are on the way. The samples/media folder exists in the tree as well.

Each topic folder carries its own README with more information about the samples inside it. That is the right granularity for the stated purpose. If you want to know how the platform handles a background location permission prompt or how a camera session is configured, you read one directory rather than navigating a monolith.

The primary language is Kotlin, and the whole thing is Apache-2.0 licensed with a 2023 copyright line in the LICENSE file. That matters more than usual for sample code: the samples are meant to be copied from, and Apache-2.0 grants that with attribution and a notice, though the obligations are yours to check rather than take from this page.

## The app module exists only to hold the sample list together

The repository root carries the usual Android project furniture: build.gradle.kts, settings.gradle.kts, gradle.properties, gradlew and gradlew.bat, plus shared/, utilities/, tools/, spotless/ and an app/ module.

The README is unusually blunt about what app/ is for. The app module is required to bring together all the samples, but it is not relevant to their functionality, and you can simply ignore it. The wiring between samples is described as an implementation detail that is not needed to understand any sample's functionality. That sentence tells you exactly how to read the tree: the interesting code is inside samples/, and app/ is a launcher.

The result is that when you run the app, you land on a samples list screen from which you can navigate to categories and individual samples. That list screen is the one piece of UI worth skipping past.

## Three steps to run it, and what you should see on screen

The documented procedure is short. Clone the repository, open the whole project in Android Studio, then sync and run the app configuration:

Before submitting a pull request, run:

```bash
./gradlew --init-script gradle/spotless-init.gradle.kts spotlessApply
```

What the README does not tell you is just as useful to know. There is no listed Android Studio version, no Gradle version, no JDK requirement and no compileSdk value, and there is no list of emulated devices or minimum API level. Anyone trying to reproduce the build on an unusual toolchain will be reading build.gradle.kts and gradle.properties directly. The absence of pinned versions in the documentation is a real gap, not a signal that compatibility is unconstrained.

## Spotless and Renovate define the maintenance contract

Two configuration files shape how the project is kept current. renovate.json at the root is the dependency update bot configuration, and spotless/ alongside gradle/spotless-init.gradle.kts is the formatting and linting setup. A build workflow badge sits at the top of the README, and CI configuration lives under .github/.

The practical consequence is that the repository expects code to be formatted mechanically before review rather than by hand. If you plan to contribute, the formatting step is not optional etiquette; the contributing page asks for the spotlessApply command to have been run before submitting a pull request.

The last push to the repository was on 2026-10-15, one day before this article's date, and the repository is not archived. There are no GitHub releases, so there is no versioned artefact to track; you take whatever is on the main branch, which means the tree can change under you between clones.

## The README rules out using this code as a starting point

A note near the top of the README states that the samples are intended to demonstrate specific functionality in isolation and may use simplified code, and that they are not intended to be used as production-ready code. For best practices it points to the Android documentation and to Now In Android.

This is not boilerplate modesty. It changes how you should evaluate the code. Simplified code in a sample exists to make one mechanism legible, which frequently means error paths are collapsed, lifecycle handling is abbreviated, and concurrency is deferred. Reading a sample to learn an API is the intended use. Reading it to decide how you will structure an application is not, and the README says so before you get there.

Now In Android is the named alternative for that second purpose, and the difference is one of intent rather than technology. Now In Android is the named alternative for best practices, while platform-samples is a set of isolated demonstrations.

## Reporting is per sample, and categories are still incomplete

Issues go through the repository's own issue tracker rather than a public bug system, and the README asks you to specify which sample the report refers to. That granularity matters in a repository where one tree holds several unrelated topics: a report without a sample name is unactionable for a maintainer triaging across Accessibility, Camera and Storage.

The category list is explicitly unfinished. The README links eight folders and closes with more to come, and the topic area itself is broad enough that a gap is not a flaw. What it does mean is that absence is not evidence that a platform area lacks samples. If you do not find a folder for the API you care about, the answer is that it has not been written yet.

Ownership and conduct files sit alongside CODE_OF_CONDUCT.md and CONTRIBUTING.md, and the README invites pull requests. For a team planning to vendor these files into an internal repository, the per sample attribution requirement in the tracker is a reasonable signal about how granular upstream fixes will be.

## Conclusion

Use android/platform-samples when you need one narrow API demonstrated end to end, such as a single camera or storage capability, and you want a build you can read in one sitting. Do not adopt it as an architecture reference or a dependency: the README points at Now In Android for that. Before building, check whether your local Android Studio and Gradle configuration matches the build this repository expects, since the README documents no pinned versions.

## FAQ

### How do I run the samples in android/platform-samples?

Clone the repository, open the whole project in Android Studio, then sync and run the app configuration. The app opens on a samples list screen for navigating categories and individual samples.

### Can I use android/platform-samples code in a production app?

No. The README states the samples are intended to demonstrate functionality in isolation, may use simplified code, and are not intended to be used as production-ready code.

### Which sample should I follow for best practices instead of android/platform-samples?

The README points to the Android documentation and to Now In Android for best practices. The app module in platform-samples only gathers the samples and carries no relevance to their functionality.

## Sources

- [android/platform-samples on GitHub](https://github.com/android/platform-samples)
- [Issues](https://github.com/android/platform-samples/issues)
- [License: Apache-2.0](https://github.com/android/platform-samples/blob/main/LICENSE)
- [Project website](https://developer.android.com/about)
- [README](https://github.com/android/platform-samples/blob/main/README.md)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/android-platform-samples
