我已经设置了一个Java应用程序,我正在创建一组4张卡片.问题是所有卡片都不会立刻进入.有时候只有一个出现,然后几秒钟或几分钟后出现其他卡片.如何让他们同时出现在耳机上?
编辑:我尝试了HTML分页,但是没有用,现在我觉得我更困惑了.所以在我的senario中,我想向用户发送一堆他们可以导航到的地标.我希望捆绑中的所有地标,我想要捆绑的捆绑包不是捆绑中的选项说"这里是你的地标",我希望捆绑包同时到达用户.我怎样才能做到这一点?
TimelineItem timelineItemEmpire = new TimelineItem();
timelineItemEmpire.setText("Empire State Building");
// Triggers an audible tone when the timeline item is received
timelineItemEmpire.setNotification(new NotificationConfig().setLevel("DEFAULT"));
Location empireLoc = new Location();
empireLoc.setLatitude(40.748492);
empireLoc.setLongitude(-73.985868);
timelineItemEmpire.setLocation(empireLoc);
// Attach an image, if we have one
URL url = new URL(WebUtil.buildUrl(req, "/static/images/empirestate.jpg"));
timelineItemEmpire.setBundleId(bundleId);
List<MenuItem> menuItemList = new ArrayList<MenuItem>();
menuItemList.add(new MenuItem().setAction("NAVIGATE"));
timelineItemEmpire.setMenuItems(menuItemList);
MirrorClient.insertTimelineItem(credential, timelineItemEmpire, contentType, url.openStream());
TimelineItem timelineItemCP = new TimelineItem();
timelineItemCP.setText("Central Park");
// Triggers an audible tone when the timeline item is received
timelineItemCP.setNotification(new NotificationConfig().setLevel("DEFAULT"));
// Attach …Run Code Online (Sandbox Code Playgroud) https callbackUrl的限制以及整个订阅的性质使得看起来这只能通过可公开访问的URL来完成.
到目前为止,我遇到了两个可能使本地开发/调试更容易的潜在解决方案.
第一个是谷歌提供的订阅代理服务.此解决方法实质上允许您将SSL限制和代理订阅回调删除到自定义URL.
我发现在本地进行开发的第二个也是最有用的方法是将订阅回调请求(例如从可公开访问的服务器)捕获到日志中,然后使用curl使用类似的东西在本地/ dev机器上重现该请求:
curl -H "Content-type: application/json" -X POST \
-d '{"json for":"the notification"}' http://localhost:8080/notify
Run Code Online (Sandbox Code Playgroud)
由于请求有时可能很大,或者您可能想要测试多个回调类型,我还发现将下标请求的JSON放入各种文件(例如:) timeline-respond.json然后运行很有用.
curl -H "Content-Type: application/json" \
--data @timeline-respond.json http://localhost:8080/notify
Run Code Online (Sandbox Code Playgroud)
我很好奇其他人在本地测试他们的应用程序订阅.
我可以在Glass上运行示例APK CompassActivity应用程序,但是LevelActivity或StopWatchActivity没有运气吗?我正在使用Eclipse.记录下面.有什么建议?
[2013-07-29 17:02:18 - LevelActivity] ------------------------------
[2013-07-29 17:02:18 - LevelActivity] Android Launch!
[2013-07-29 17:02:18 - LevelActivity] adb is running normally.
[2013-07-29 17:02:18 - LevelActivity] No Launcher activity found!
[2013-07-29 17:02:18 - LevelActivity] The launch will only sync the application package on the device!
[2013-07-29 17:02:18 - LevelActivity] Performing sync
[2013-07-29 17:02:28 - LevelActivity] Uploading LevelActivity.apk onto device '015DA7720F00D016'
[2013-07-29 17:02:28 - LevelActivity] Installing LevelActivity.apk...
[2013-07-29 17:02:29 - LevelActivity] Success!
[2013-07-29 17:02:29 - LevelActivity] /LevelActivity/bin/LevelActivity.apk installed on device
[2013-07-29 17:02:29 …Run Code Online (Sandbox Code Playgroud) From a native application how can we detect Google Glass verses a smart phone from code?
Moving correct answer to question:
boolean isRunningOnGlass() {
return "Google".equalsIgnoreCase(Build.MANUFACTURER) && Build.MODEL.startsWith("Glass");
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试在Google Glass中显示实时相机预览.
我正在使用所有相机默认设置(并且还尝试使用一些不同的图像格式;理想情况下,我可以使用其中一种YUV格式),但显示屏中显示的图像是乱码,如下所示:

布局很简单:
<?xml version="1.0" encoding="utf-8"?>
<TextureView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scan_preview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
Run Code Online (Sandbox Code Playgroud)
这是活动代码:
public class ScanActivity extends Activity {
private static final String kTag = ScanActivity.class.getSimpleName();
private TextureView mVideoCaptureView = null;
private Camera mCamera = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scan);
setTitle(R.string.title_scan);
mVideoCaptureView = (TextureView) findViewById(R.id.scan_preview);
mVideoCaptureView.setKeepScreenOn(true);
mVideoCaptureView.setSurfaceTextureListener(new VideoCaptureTextureListener());
}
@Override
protected void onPause() {
super.onPause();
stopVideo();
}
@Override
protected void onResume() {
super.onResume();
startVideo();
}
private void startVideo() {
if (mCamera != null) {
mCamera.release(); …Run Code Online (Sandbox Code Playgroud) 我有兴趣根据某些事件更改卡片的文字.是否可以在不调用setContentView()活动的情况下更改卡片的文本?
一旦将卡转换为视图并使用设置setContentView(),我还没有找到更改其内容的方法,而无需再次调用'setContentView()'.
getLastLocation()从LocationManager经常返回null的方法来选择最佳提供者是非常棘手的.文件说:
警告:不要使用LocationManager.getBestProvider()方法或常量GPS_PROVIDER或NETWORK_PROVIDER来侦听位置更新.Glass使用一组动态提供程序,仅侦听单个提供程序可能会导致应用程序错过位置更新.
如何获得最佳位置?
说"ok glass"会显示一个命令列表,根据用户的头部动作自动滚动.
GDK中是否有内置的UI元素来实现这一点?或者我是否必须编写自己的使用传感器的代码?