Google Glass SDK/Mirror API and Glassware

来源:互联网 发布:sql中references 编辑:程序博客网 时间:2024/05/02 00:26

We are actively working on a Glass Development Kit (GDK) that allows you to build Glassware in the form of APKs. We’re still hard at work on the GDK, but in the meantime, you can start designing and developing your awesome ideas with the existing Android SDK. Although you won’t have all the tools necessary to design the perfect experience for Glass, developing with the Android SDK lets you try out ideas while you wait for the GDK.

Glass is built on the Android 4.0.4 platform, so you can write APKs using the standard Android SDK (API Level 15) and sideload them onto Glass. The Android SDK provides you with a wide range of APIs to do things such as access the low-level hardware, render OpenGL, use stock Android UI widgets, and much more. You can even use the Android NDK to develop.

We encourage you to start developing APKs for Glass and experiment with what you can do. For more information on utilizing the Android platform and if you're adventurous, gaining root shell access, see the Void Your Warranty Google I/O session video.

Samples

All of our APK samples are available on GitHub and we will be adding more. When we launch the GDK, we'll also update these samples to show the migration path from a traditional Android app to a full Glass experience. Make sure to check regularly for updates:

CompassLevelStopwatch

PrerequisitesA good understanding of Android development. See the 

Android developer training site for information on how to get started. Because Glass is built on the Android platform, you can use many Android resources that are already published for help.Android SDK - This is needed for development.Glass - You can push the code to an Android device or emulator but to design a real Glass experience, you need the actual device.

Importing and compiling the samples

Checkout the samples onto your filesystem and use your favorite IDE to import and compile the code.

In Eclipse and ADTClick 

File > Import ... > Existing Android Code into Workspace.Click **Browse**, select the location of the apk-[sampleName]-sample/ directory, and click **OK**.Select the **apk-[sampleName]-sample** project to import it and select **Copy projects into workspace**.Click **Finish** to complete the import.

In Android StudioCheckout the sample to a location where you keep your Android development projects. A apk-[sampleName]-sample/ directory is created.Click 

File > Import Project ..., select the location of the apk-[sampleName]-sample/ directory, and click **Next** until you see the **Finish** button.Click **Finish** to complete the import.

Turning on debug mode

You'll need to turn on debug mode before you do any type of development on Glass. Go to **Settings > Device Info > Turn on debug** to enable it.


Running the APK on Glass

You can use your IDE to compile, install, and run the APK or use adb on the command line:
$ adb install -r [sampleName].apk

$ adb shell am start -n com.google.glass.samples.<sampleName>/.<MainActivityName>

1
**Note:** The Glass screen must be on when you run the APK.
原创粉丝点击