How to get shared Glympse link?

606 Views Asked by At

I have to implement live tracking using Glympse. In Glympse application you can share a link that link will show your current location. Now I have to get that link and send that link to server. I am searching for it but I am unable to get desired solution to get that link.

I have got examples form https://developer.glympse.com/docs/core/client-sdk/downloads link.

1

There are 1 best solutions below

3
On BEST ANSWER

The GlympseCreateDemo shows the steps needed to get the link, but here are the key parts.

// 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);

To listen for when the link is available

// 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();
        }
    }
}