2016-12-14 144 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