Package 

Class ShareApi


  • 
    public final class ShareApi
    
                        

    Provides an interface for sharing through the graph API. Using this class requires an access token in AccessToken.currentAccessToken that has been granted the "publish_actions" permission.

    • Constructor Summary

      Constructors 
      Constructor Description
      ShareApi(ShareContent shareContent) Constructs a new instance.
    • Method Summary

      Modifier and Type Method Description
      String getMessage() Returns the message the person has provided through the custom dialog that will accompany theshare content.
      void setMessage(String message) Sets the message the person has provided through the custom dialog that will accompany theshare content.
      String getGraphNode() Returns the graph node to share to.
      void setGraphNode(String graphNode) Sets the graph node to share to (this can be a user id, event id, page id, group id, album id,etc).
      ShareContent getShareContent() Returns the content to be shared.
      static void share(ShareContent shareContent, FacebookCallback<Sharer.Result> callback) Convenience method to share a piece of content.
      boolean canShare() Returns true if the content can be shared.
      void share(FacebookCallback<Sharer.Result> callback) Share the content.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ShareApi

        ShareApi(ShareContent shareContent)
        Constructs a new instance.
        Parameters:
        shareContent - the content to share.
    • Method Detail

      • getMessage

         String getMessage()

        Returns the message the person has provided through the custom dialog that will accompany theshare content.

      • setMessage

         void setMessage(String message)

        Sets the message the person has provided through the custom dialog that will accompany theshare content.

        Parameters:
        message - the message.
      • setGraphNode

         void setGraphNode(String graphNode)

        Sets the graph node to share to (this can be a user id, event id, page id, group id, album id,etc).

        Parameters:
        graphNode - the graph node to share to.
      • getShareContent

         ShareContent getShareContent()

        Returns the content to be shared.

      • share

         static void share(ShareContent shareContent, FacebookCallback<Sharer.Result> callback)

        Convenience method to share a piece of content.

        Parameters:
        shareContent - the content to share.
        callback - the callback to call once the share is complete.
      • canShare

         boolean canShare()

        Returns true if the content can be shared. Warns if the access token is missing thepublish_actions permission. Doesn't fail when this permission is missing, because the app couldhave been granted that permission in another installation.

      • share

         void share(FacebookCallback<Sharer.Result> callback)

        Share the content.

        Parameters:
        callback - the callback to call once the share is complete.