2013-05-22 14 views
7

私は4枚のカードのバンドルを作成するJavaアプリケーションをセットアップしました。問題は、すべてのカードが一度に入ってこないということです。ちょうど1回だけ表示され、数秒後または1分後に他のカードが表示されます。どのようにしてそれらをヘッドセットに同時に表示させることができますか?バンドルされたカードを一度に送信するにはどうすればよいですか?

編集: HTMLページングを試してみましたが、うまくいきませんでしたが、今はもっと混乱していると思います。だからここの私のシナリオでは、ユーザーに移動できるランドマークをたくさん送りたいと思っています。私はすべてのランドマークをバンドルに入れたいと思うので、バンドルに「ここはあなたのランドマークです」というオプションではないバンドルをカバーしたいと思います。バンドルを同時にすべてのユーザーに渡したい。どうすればこれを達成できますか?あなたのカバーにtrueisBundleCoverリソースを設定する必要が

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()); 
+0

実際には、HTMLページングが必要なようです。それを今試みている。 – Pickles

+0

ページングが私にとってはうまくいきません。 – Pickles

答えて

6

。すなわち:

timelineCover.setIsBundleCover(true); 

は、これは、バンドルへのエントリポイントになります、そしてそれはhereに記載されているように、バンドル内に表示されるのを防ぎます。

さらに、BatchRequestを使用してそれらが一緒に送信されていることを確認することもできます。例:

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(); 
+0

ありがとう!これはうまくいった。私がオンラインで見逃したいくつかのドキュメントからこれを手に入れましたか?もしそうなら、私にそれを指摘することができます。 – Pickles

+0

クール - setIsBundleCoverメソッドが私の答えで述べたドキュメントを閲覧し、BatchRequestクラスがGoogleのクイックスタートプロジェクトを読んでいるのを見ました。 – MikeV

関連する問題