Scott
Scott

Reputation: 3732

How can my app tell if it's running in Chrome vs on an Android device?

If I use ARCWelder to port my app to Chrome, is there a way for it to know that it's running on Chrome? Maybe through BUILD.Version?

Upvotes: 2

Views: 839

Answers (2)

Vandan Phadke
Vandan Phadke

Reputation: 71

//Check for brand and manufacturer
if(Build.BRAND.equals("chromium") && Build.MANUFACTURER.equals("chromium")){
      /*Code to be executed if app is running on chromium*/
}

Upvotes: 2

CommonsWare
CommonsWare

Reputation: 1007584

Quoting the documentation:

If you need to check if your app is running on Chrome OS, look for chromium as the android.os.Build.BRAND and android.os.Build.MANUFACTURER.

Upvotes: 3

Related Questions