Class SFSInvitation

  • All Implemented Interfaces:
    Invitation

    public class SFSInvitation
    extends java.lang.Object
    implements Invitation

    Overview

    An Invitation object provides the ability to send a generic invitation for a specific event going on in your application, be it a game, visiting a personal room or another location of the virtual world etc...

    The SFS2X Invitation Manager is very simple to use. All you need to provide is:

    • inviter: the User starting the invitation (null == Server)
    • invitee: the User to invite
    • expiryTime: the amount of time (in seconds) that the invitee has to accept/refuse the invitation. (default is 15 sec)
    • params: any custom params to send with the invitation (e.g. a message, game name etc...)
    The Invitation system will then fire events back to a CallBack handler that you will provide in the form of a Class extending InvitationCallback.
    See Also:
    InvitationCallback, SFSGameApi.sendInvitation(Invitation, InvitationCallback)
    • Constructor Detail

      • SFSInvitation

        public SFSInvitation​(User inviter,
                             User invitee,
                             int secondsForAnswer)
      • SFSInvitation

        public SFSInvitation​(User inviter,
                             User invitee,
                             int secondsForAnswer,
                             ISFSObject params)
    • Method Detail

      • getId

        public int getId()
        Description copied from interface: Invitation
        Get the unique invitation ID
        Specified by:
        getId in interface Invitation
        Returns:
        the id
      • getParams

        public ISFSObject getParams()
        Description copied from interface: Invitation
        An SFSObject of custom parameters can be attached to the invitation. It could contain any properties relevant to the invitation, like a message, the game type/settings and any other parameter.
        Specified by:
        getParams in interface Invitation
        Returns:
        the custom parameters
        See Also:
        SFSObject
      • setParams

        public void setParams​(ISFSObject params)
        Description copied from interface: Invitation
        An SFSObject of custom parameters can be attached to the invitation. It could contain any properties relevant to the invitation, like a message, the game type/settings and any other parameter.
        Specified by:
        setParams in interface Invitation
        Parameters:
        params - the custom parameters
        See Also:
        SFSObject
      • getInviter

        public User getInviter()
        Description copied from interface: Invitation
        Get the Inviter, the user that started this invitation
        Specified by:
        getInviter in interface Invitation
        Returns:
        the inviter
      • getInvitee

        public User getInvitee()
        Description copied from interface: Invitation
        Get the Invitee, the user that receives the invitation
        Specified by:
        getInvitee in interface Invitation
        Returns:
        the invitee
      • getExpiryTime

        public int getExpiryTime()
        Description copied from interface: Invitation
        The expiration timestamp.
        Specified by:
        getExpiryTime in interface Invitation
        Returns:
        expiration timestamp.
      • isExpired

        public boolean isExpired()
        Description copied from interface: Invitation
        Checks if the invitation is expired.
        Specified by:
        isExpired in interface Invitation
        Returns:
        true if the invitation is expired
      • getSecondsForAnswer

        public int getSecondsForAnswer()
        Description copied from interface: Invitation
        The amount of seconds given to the invitee to respond to the invitation
        Specified by:
        getSecondsForAnswer in interface Invitation
        Returns:
        the amount of seconds given to the invitee to respond to the invitation
      • setCallback

        public void setCallback​(InvitationCallback callback)
        Description copied from interface: Invitation
        Set the CallBack handler for the invitation. The handler will be invoked by the system when the invited User accepts or refuses the invitation or if the invitation expires.
        Specified by:
        setCallback in interface Invitation
        Parameters:
        callback - the callback handler
        See Also:
        InvitationCallback
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object