Is there any way to run glassware in an emulator?

烈酒焚心 提交于 2019-11-30 02:05:33

Only a small percentage of the sample code seems to be using the GDK libraries. For example, the Compass example has a CompassService that is in charge of attaching the CompassRenderer into the Glass Live Card. It also has a CompassMenuActivity, that basically has calls to standard Android menu rendering. Those could be called a "glue" that wrap the compass-functionality into the Glass experience. Major parts of the compass code are just standard Android libraries.

Assuming that the emulator currently does not have a way to run glass libraries (and no-one has hacked them into it yet), and if you want to run the Compass example without actual Glass hardware, you need to implement the Service & MenuActivity in your own "standard Android" way. Basically, create an activity that implements the CompassRenderer in a surfaceview.

Have a look at these commits for an example (tested on Galaxy S4, views are being rendered and menu items are functional):

https://github.com/blaind/gdk-stopwatch-sample/commit/26e9801af983b9fc931d6dfe5ce1fcb80766fd10 https://github.com/blaind/gdk-compass-sample/commit/0d89e922a167c0fac6890684c514b9028e7bfea8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!