如何同时发送捆绑卡? [英] How do I send bundled cards all at the same time?

查看:129
本文介绍了如何同时发送捆绑卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了一个Java应用程序,我正在创建一组4张卡片。问题是所有卡都不会立刻进入。有时候只有一个出现,然后几秒或几分钟后出现其他卡片。如何同时将它们全部显示在耳机上?

I've set up a Java application where I'm creating a bundle of 4 cards. The problem is that all the cards do not come in at once. Some times just one shows up, then a few seconds or minute later the other cards show up. How do I get them to all show up on the headset at the same time?

编辑:
我尝试过HTML分页,但是现在无法正常工作我想我更困惑。所以在我的Senario这里,我想向用户发送一堆他们可以导航到的地标。我希望捆绑中的所有地标,我想要捆绑包不是捆绑中的选项说这里是你的地标,我希望捆绑包同时到达用户。我怎样才能做到这一点?

edit: I tried HTML paging and that didn't work and now I think I'm more confused. So in my senario here I want to send a bunch of landmarks to the user that they can navigate to. I want all the landmarks in a bundle, I want a cover to the bundle that isn't an option in the bundle saying "here are your landmarks", and I'd like the bundle to get to the user all at the same time. How can I achieve this?

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 an image, if we have one
URL url3 = new URL(WebUtil.buildUrl(req, "/static/images/central_park.jpg"));
timelineItemCP.setBundleId(bundleId);

Location cpLoc = new Location();
cpLoc.setLatitude(40.772263);
cpLoc.setLongitude(-73.974488);
timelineItemCP.setLocation(cpLoc);
timelineItemCP.setMenuItems(menuItemList);

MirrorClient.insertTimelineItem(credential, timelineItemCP, contentType, url3.openStream());      

TimelineItem timelineCover = new TimelineItem();
timelineCover.setText("Nearby Landmarks");
timelineCover.setBundleId(bundleId);

// Triggers an audible tone when the timeline item is received
timelineCover.setNotification(new NotificationConfig().setLevel("DEFAULT"));

// Attach an image, if we have one
URL url4 = new URL(WebUtil.buildUrl(req, "/static/images/bundle_cover.jpg"));

MirrorClient.insertTimelineItem(credential, timelineCover, contentType, url4.openStream());  


推荐答案

您需要设置 isBundleCover 资源到 true 为您的封面;即:

You need to set the isBundleCover resource to true for your cover; i.e.:

timelineCover.setIsBundleCover(true);

这将使其成为捆绑包的入口点,并防止它在捆绑包中显示,如此处所述。

This will make it the entry point into the bundle, and prevent it from being displayed within the bundle, as described here.

此外,您可以使用BatchRequest确保它们一起发送;例如,

Furthermore, you can use BatchRequest to make sure they're sent together; e.g.,:

BatchRequest batch = MirrorClient.getMirror(null).batch();
BatchCallback callback = new BatchCallback();

for (TimelineItem item : items) {
        MirrorClient.getMirror(userCredential).timeline().insert(item).queue(batch, callback);
}

batch.execute();

这篇关于如何同时发送捆绑卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆