Add android strict mode documentation (#2719)

This commit is contained in:
Timothy 2025-07-09 10:07:50 +02:00 committed by GitHub
parent 8de9ba5404
commit 26070fb788
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 0 deletions

View File

@ -24,6 +24,7 @@ Are you ready to make a difference in the world of smart home technology? The **
We welcome contributions of all kinds! Here are some ways you can get involved:
- **Join the [beta](https://play.google.com/apps/testing/io.homeassistant.companion.android)**: Help us catch issues before they reach production.
- **Code contributions**: Fix bugs, add features, or improve performance.
- **Code reviews**: Help others by reviewing their work and providing constructive feedback.
- **Documentation**: Keep our guides clear, concise, and up-to-date.

View File

@ -0,0 +1,20 @@
---
title: "StrictMode"
sidebar_label: "StrictMode"
---
## StrictMode in debug builds
StrictMode is enabled by default when you run the app in debug mode on Android. StrictMode helps you identify accidental disk or network access on the main thread, as well as other potential issues during development. For more information, see the [StrictMode documentation](https://developer.android.com/reference/android/os/StrictMode).
StrictMode also helps us migrate to new versions of the Android API by highlighting deprecated or problematic behaviors early in development.
The [VM policy](https://developer.android.com/reference/android/os/StrictMode.VmPolicy.Builder) is configured with the `death` penalty, and the [threading policy](https://developer.android.com/reference/android/os/StrictMode.ThreadPolicy.Builder) is set to `log`. Review the logs carefully while developing to spot and address any issues.
If you encounter a problem caused by StrictMode during development, you can temporarily disable it by setting the `noStrictMode` Gradle flag:
```bash
./gradlew app:assembleFullDebug -PnoStrictMode
```
If you need to disable StrictMode, open an issue on GitHub or reach out on Discord. This helps ensure the problem is tracked and does not impact other developers.

View File

@ -351,6 +351,7 @@ module.exports = {
"android/tips/sarif_reports",
"android/tips/release",
"android/tips/dev_playground",
"android/tips/strict_mode",
],
},
"android/best_practices",