Using Vuzix HUD API Resources and Packages
  • 05 Sep 2024
  • 2 Minutes to read
  • Contributors
  • Dark
    Light

Using Vuzix HUD API Resources and Packages

  • Dark
    Light

Article summary

It is recommended that you utilize Vuzix libraries to design your user experience. Adding these libraries to your Android project is simple and developer friendly. Vuzix provides a maven repository hosted on jitpack.io for those libraries and other resources.


Adding HUD-Resources to your Android Application

To be able to utilize the HUD-Resources libraries, you will need to add a dependency in your application build.gradle file.

In your app's build.gradle file just add the following line to your dependencies section:

  • implementation 'com.vuzix:hud-resources:**VERSION**'

Your build.gradle for your application will look something like this:

apply plugin: 'com.android.application' 
android {
	compileSdkVersion 30 defaultConfig {
		applicationId "com.vuzix.shield.devkit.camera_sample"
		minSdkVersion 30
   		targetSdkVersion 30
		versionCode 1
		versionName "1.0"
	}
	buildTypes {
		release {
			minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
		}
	}
}
dependencies {
	implementation 'com.vuzix:hud-resources:**VERSION**'
}

The latest version is:

You will also need to add a repository in your projects's build.gradle file.

In your projects's build.gradle file add the following to your repositories section:

Your build.gradle for your project will look something like this:

allprojects {
	repositories {
		google()
		maven{
			url "https://jitpack.io"
		}
	}
}


Android Jetpack Compatibility

Beginning with version 2.0, the HUD-Resources libraries support Android Jetpack. In addition, the HUD themes are based on Theme.AppCompat rather than Theme.Material.

If you are not using Jetpack in your application, you should not upgrade past version 1.6 of the HUD libraries. If you choose to migrate to Jetpack in the future, you can also upgrade to the latest HUB libraries at that time.


Determining Shield Model

Using the Utils class of the HUD-Resources library, you can quickly determine which model of the Blade your application is currently running on.
This is particularly useful if your application provides the user feedback (i.e. audio or haptic feedback).

To do this, simply call the Utils class using the method described below:

if(Utils.getModelNumber() == Utils.DEVICE_MODEL_SHIELD) {
	//This app is currently running on a Shield
}


Utilizing the HUD Themes

With the HUD-Resource library in your project, you can now use the HUD theme as your main application theme.

These themes will provide a good base for your application design and will also provide the color scheme as the default one for your layout.

To use the HUD theme as the main theme of the application, you just need to modify the Application Manifest and ensure the android:theme is "@style/HudTheme".

Your Android Manifest will look something like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
	package="com.vuzix.shield.devkit.camera_sample">
	<application
		android:allowBackup="true"
		android:icon="@mipmap/ic_launcher"
		android:label="@string/app_name"
		android:roundIcon="@mipmap/ic_launcher_round"
		android:theme="@style/HudTheme">
		<activity android:name=".MainActivity"> 
			<intent-filter>\
				<action android:name="android.intent.action.MAIN" />
				<category android:name="android.intent.category.LAUNCHER" />
			</intent-filter>
		</activity>
	</application>
</manifest>


Utilizing HUD API Classes

The Vuzix HUD libraries include our customized versions of Activity classes and other frequently used classes.

Our extension of those classes provide extra functionality, improve performance and add custom features to take full advantage of the Shield platform.

We recommend that all your Activities extend the "Activity". Your Main Activity Class definition will look something like this:

public class MainActivity extends Activity { 
	. . .
}


HUD Libraries Java Docs

For more information and details check our Javadocs.


Was this article helpful?