我必须使用 Glympse 实现实时跟踪。在 Glympse 应用程序中,您可以共享一个链接,该链接将显示您当前的位置。现在我必须获取该链接并将该链接发送到服务器。我正在寻找它,但我无法获得所需的解决方案来获取该链接。
我有来自https://developer.glympse.com/docs/core/client-sdk/downloads链接的示例。
我必须使用 Glympse 实现实时跟踪。在 Glympse 应用程序中,您可以共享一个链接,该链接将显示您当前的位置。现在我必须获取该链接并将该链接发送到服务器。我正在寻找它,但我无法获得所需的解决方案来获取该链接。
我有来自https://developer.glympse.com/docs/core/client-sdk/downloads链接的示例。
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();
}
}
}