Search code examples
androidapkgoogle-chrome-osmulti-windowandroidappsonchromeos

How to find if android app is started by AndroidOS or ChromeOS's android container?


ChromeOS has started supporting Android apps. https://developer.android.com/topic/arc/optimizing

Android apps when running within ChromeOS requires a bunch of optimizations and these optimizations apply only to the app when running in chrome environment.

  • Is it possible to use the same app APK file for both Android and chrome or should have separate APK files?

  • Is it possible to differentiate the environment (Android or ChromeOS) programmatically within the app?

    • Differentiating based on the availability of touchscreen feature is not valid anymore since some Chromebooks ships with touchscreens and can be used as a tablet.

Thanks


Solution

  • Is it possible to use the same app APK file for both Android and chrome or should have separate APK files?

    Yes, it is possible to use same apk for Android and ChromeOS if you don't have any special feature which is not available on ChromeOS. No need to create separate APK.

    Device Support:

    You can use the Google Play Store to install Android apps on several Google Chromebooks. This document describes the Chromebooks, Chromeboxes, and Chromebases that can install Android apps, both currently and in upcoming releases of Chrome OS.

    If your app will have any feature which is not available on ChromeOS then that app will not be available on PlayStore for ChromeOS i.e. from ChromeOS you will not be able to see that app on PlayStore.

    App manifest compatibility for Chromebooks:

    As you prepare your Android app to run on Chromebooks, you should consider the device features that your app uses. Chromebooks don't support all of the hardware and software features that are available on other devices running Android. If your app requires specific features that aren't supported on Chromebooks, it won't be available for installation on Chromebooks.

    Is it possible to differentiate the environment (Android or ChromeOS) programmatically within the app?

    Yes it is possible to check if app is running on ChromeOS using below code:

    context.getPackageManager().hasSystemFeature("org.chromium.arc.device_management");