Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I determine if my code is running on Google Glass?

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?

like image 391
ErstwhileIII Avatar asked Oct 02 '22 16:10

ErstwhileIII


1 Answers

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;
}
like image 142
ErstwhileIII Avatar answered Oct 05 '22 13:10

ErstwhileIII