How to detect programmatically if the "Android application" works in a chrome book or on an Android phone

Since Google announced that chromebook also supports Android app, so I also wanted to support my chromebook app, although it works fine with a slight exception that I need to fix.

I want to write the code in such a way that it will only run for the chromebook and will not run for Android phones and tablets.

I have a Chromebook documentation check on the Android developer site, I didn’t have an API that says your application runs in a chrome book environment.


Offer ARC Beta Documentation Doesn't Work:

If you need to check if your application works in Chrome OS, find chrome as android.os.Build.BRAND and android.os.Build.MANUFACTURER .

Both return Google to ASUS Chromebook.

+7
android chromebook androidappsonchromeos
source share
3 answers

Finally, I'll figure out a way to find out if an application works in ARC:

 context.getPackageManager().hasSystemFeature("org.chromium.arc.device_management"); 
+7
source share

Another method Google uses in its own code is to check if Build.DEVICE " _cheets " _cheets . I don’t know if the device end names are like this, is some kind of long-term strategy or a quick workaround, but it is also worth looking in addition to the proposed dex solution.

FWIW, since the ARCWelder method is deprecated and there is no official documentation on this (yet), I also started a discussion in the XDA forums here for people to discuss what works / doesn't work on different devices.

0
source share

With the latest SDK you can do

 PackageManager pm = context.getPackageManager(); if (pm.hasSystemFeature(PackageManager.FEATURE_PC)) // it a chromebook 

For older devices (and at the moment everyone is "old", in my opinion, ARC), the official way to do:

 if (Build.BRAND != null && Build.BRAND.equals("chromium") && Build.MANUFACTURER.equals("chromium")) // it a chromebook 
0
source share

All Articles