I would like to create some utility classes to use on both Android phones and on Google Glass (using the GDK). There are some differences to take care of when running on Glass (e.g. getting location).
Is there some static method call one can use or another way to determine whether the code is running on Glass?
Ok .. here is a method that one can use to determine whether code is running on Google Glass device (rolling up information from Jeff Tang):
/** Determine whethe the code is runnong on Google Glass
* @return True if and only if Manufacturer is Google and Model begins with Glass
*/
public boolean isRunningOnGlass() {
boolean result;
result = "Google".equalsIgnoreCase(Build.MANUFACTURER) && Build.MODEL.startsWith("Glass");
Log.d(getLocalClassName(), "Running on Glass = " + result + "Manufacturer is " + Build.MANUFACTURER + ", Model is " + Build.MODEL);
return result;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With