2016-12-14 113 views

回答

0

GlympseCreateDemo顯示獲取鏈接所需的步驟,但這裏是關鍵部分。

// Create the ticket for the given duration. 
GTicket ticket = GlympseFactory.createTicket(duration, null, null); 

// For the recipient list, we create a single "LINK" recipient. This 
// means we want a recipient URL for the new Glympse without having 
// the Glympse API actually send the invite out to anyone. 
GInvite recipient = GlympseFactory.createInvite(GC.INVITE_TYPE_LINK, null, null); 
ticket.addInvite(recipient); 

// Call sendTicket to create the ticket and the recipient URL. 
_glympse.sendTicket(ticket); 

要監聽當鏈路可用

// The object you pass to this method must implement GEventListener 
// In the demo this is done in GlympseCreateDemoActivity.java 
ticket.addListener(this); 

// Once the invite is ready you will get this event 
@Override public void eventsOccurred(GGlympse glympse, int listener, int events, Object obj) 
{ 
    if (GE.LISTENER_TICKET == listener) 
    { 
     if (0 != (events & GE.TICKET_INVITE_CREATED)) 
     { 
      GTicket ticket = (GTicket) obj; 
      // This string will contain the link that you can send to your server 
      String theUrlLink = ticket.getInvites().at(0).getUrl(); 
     } 
    } 
} 
+0

共享Glympse後。我們在狀態欄上有一個顯示共享Glympse狀態的圖標。我們可以從狀態欄(通知)中刪除它嗎? – Madhu

+1

可以阻止這些通知。 GlympseService.enableGlympseNotifications(假);在調用Glympse平臺上的start()之前必須調用這個函數 –

+0

在我的應用程序中,我已經將鏈接發送給服務器而不是朋友。有沒有什麼辦法可以直接使用RestAPI發送glympse鏈接(即.api後)?或者誰可以成爲Glympse Location鏈接的收件人?我可以與服務器共享一個鏈接嗎? – Madhu