Android(Go バージョン)向け開発のベスト プラクティス
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Android(Go バージョン)向けにアプリの開発や最適化を始める際は、以下のベスト プラクティスと一般的な質問に対する回答に沿って行ってください。
- アプリに過剰な権限を追加しないでください。
- アプリがバックグラウンドで実行中で、デバイスがバッテリー残量の少ない状態で動作しているときは、アプリのアクティビティを最小限にする必要があります。
- デバイスが省電力状態に移行できなくなるので、wake lock は使用しないでください。
- wakeup の回数を減らすために、ネットワーク アクティビティをひとまとめにしてください。WorkManager を使用すると、タスクをスケジューリングして、システムに一括処理させることができます。
- 小さい画面でテストしてレイアウトがスケールダウンされることを確認してください。
isLowRamDevice()
や getMemoryClass()
などのメソッドは、ランタイム時にメモリの制約を判断するのに役立ちます。これらの情報を使用して、メモリ使用量を抑えることができます。たとえば、メモリの少ないデバイスでは低解像度の画像を使用するといったことが可能です。
AndroidManifest.xml
ファイルで android:installLocation
フラグを使用し、外部ストレージにアプリをインストールできるようにします。
- より多くのユーザーに向けて開発する場合は、何十億人ものユーザー向けにアプリを構築するをご覧ください。
Go 向けに最適化するか、最初から対応するか
Android Go でアプリをリリースしようとしている多くのデベロッパーは、既存のアプリを最適化するべきか、まったく新しいアプリを開発するべきか迷っているかもしれません。この選択は、開発リソースの量、そうしたデバイスに最適化された機能をアプリに残せるかどうか、世界中のエンドユーザーに対してどのような種類の配布シナリオを有効にするかなど、さまざまな要因によって決まります。
- 1 つのアプリですべてのデバイスに対応
- 同じアプリで、Android(Go バージョン)デバイスと他のすべてのデバイスに、変わらないエクスペリエンスを提供します。この場合は、既存のアプリがこういったデバイスで適切に動作するように最適化します。そうすれば、既存のユーザーもそうした最適化からパフォーマンス上のメリットを得られます。コードをリファクタリングせずに、サイズを大幅に縮小するために Android App Bundle を使用することを強くおすすめします。
- 2 つのアプリ
- 新たに「軽量」アプリを作成し、Android(Go バージョン)デバイスをターゲットに設定します。既存のアプリに手を加える必要はありません。「軽量」アプリに、Android(Go バージョン)デバイスのみを対象にするという要件はないため、すべてのロケールのすべてのデバイスをターゲットに設定することができます。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-27 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-27 UTC。"],[],[],null,["# Best practices for Android (Go edition) development\n\nFollow these best practices and answers to common questions when starting to\ndevelop or optimize your app for Android (Go edition).\n\n- Don't add any excessive permissions to your app.\n- Minimize app activity when in the background and when the device is running on low power.\n- Avoid using wake locks because they prevent the device from going into low-power states.\n- Batch network activity to reduce the number of wakeups. You can use [WorkManager](/topic/libraries/architecture/workmanager) to schedule tasks and let the system batch operations.\n- Validate that your layouts scale down by testing on smaller screens.\n- Methods such as [`isLowRamDevice()`](/reference/android/app/ActivityManager#isLowRamDevice()) and [`getMemoryClass()`](/reference/android/app/ActivityManager#getMemoryClass()) help determine memory constraints at runtime. Using this information, you can scale down your memory use. For example, you can use lower resolution images on low memory devices.\n- Allow your app to be installed to external storage using the [`android:installLocation`](/guide/topics/manifest/manifest-element#install) flag in your `AndroidManifest.xml` file.\n- If you're looking to build for a larger-scaled audience, take a look at the [Build for billions](/topic/billions) documentation.\n\nOptimize for Go or start fresh\n------------------------------\n\nMany developers looking to launch apps on Android Go may wonder if they should\noptimize their existing app or develop an entirely new one. This choice depends\non many factors, including how many development resources you have, whether or\nnot you can keep features in your app that are optimized for these devices,\nand what type of distribution scenarios you want to enable for end-users around\nthe world.\n\nOne app for all\n: Use the same app for Android (Go edition) devices and all other devices with\n an identical experience. In this case, you are optimizing your existing app to\n run well on these devices, and your existing users gain performance benefits\n from those optimizations. We highly encourage you to use the\n [Android App Bundle](/guide/app-bundle) to experience significant size savings\n without having to refactor your code.\n\nTwo apps\n: Create a new \"light\" app and target Android (Go edition) devices.\n You can leave your existing app as is. The \"lite\" app can still target all\n devices in all locales as there is no requirement for this \"lite\" app to only\n target Android (Go edition) devices."]]