This document is separated into multiple sections. The first section describes:

  • Code Structure describes how the code is structured in the YesGraph SDK.
  • Convenience API creates an easy to configure, easy to use API to use YesGraph SDK.

This document does not describe all classes/functionalities that the YesGraph SDK contains. If you are looking for a specific class, you can search for it in the source code.

Code Structure

Code in the YesGraph SDK is divided into several groups. The components correspond to folder structure inside the SDK.

  • activities - Contains all the activities that are present in the SDK that are used for the share and invite flow.
  • adapters - Contains the adapter that is used to display the contacts in the ContactsActivity
  • application - Contains the basic instance of the SDK that is initialised
  • callbacks - Contains the interfaces that are used to monitor the permission grant, sms sent and text changes
  • model - Contains all the classes that are used as models in the SDK such as Contact and RankedContact
  • services - Contains the basic share service and the three default share services
  • network - Contains a basic class HttpMethod that is capable to communicate with the API at a low level and other implemented classes that are meant to be called with predefined parameters
  • utils - Contains all the classes that are needed for all the functionalities for example to change fonts, filter contacts,…

Each of the sections contains multiple classes that can also be used separately apart from the SDK. Each component is described separately in sections below.

Convenience API

To make the usage of YesGraph SDK as easy as possible, a simple Convenience API is provided. Most of the common usage scenarios can be implemented by using this API. However, for fine grain customization lower level components of the SDK may be used.

The Convenience API is implemented in the YesGraph class, which provides access to multiple convenience methods. The Convenience API also handles user authentication and the styling of all components.

The example below handles the contacts from the phone and pushes them to the SDK, using the Convenience API.

YesGraph yesGraphApplication;
yesGraphApplication.updateContactsFromPhone(new Handler.Callback() {
  public boolean handleMessage(Message msg) {
    if (msg.what == Constants.RESULT_OK) {
      //handle the response that is represented as a ContactsList and is ready to use in a RecyclerView or any other way
      ContactList contactList = (ContactList) msg.obj;
    } else {
      if (msg.obj instanceof JSONObject) {
        //handle the JSON error object
        JSONObject jsonObject = (JSONObject) msg.obj;
      } else {
        //handle the error that is not in JSON format
    return false;

The convenience API also handles uploading of address book to YesGraph API and is triggered when application is activated. By default only if contact book was not updated for more than 24 hours, it is uploaded.

Share Services

Share services are the main component of the YesGraph SDK and are displayed by Share Sheet. Each represents a single share point, to where a message can be shared. Share services have a property which you can use to specify your own message when required.

Out of the box, YesGraph SDK provides three share services:

  • Facebook share shares a message to Facebook using Facebook app or web browser.
  • Twitter share shares a message to Twitter using Twitter app or web browser.
  • Invite shares a message to a Contact Book contact by either Email or Messages app.

Invite Share Service

Invite Share Service is a share service exclusive to the YesGraph SDK. It uses device’s local contact book to retrieve contacts and YesGraph API to correctly rank them and suggest which contacts are most frequently used by the configured user.

Invite Share Service divides email and phone contacts, because each of them use a different messaging method.

Once contacts are selected and the invite button is pressed, it will open a list of intents to share emails for email contacts and a list of intents to share messages for phone number contacts.

Invite Share Service is implemented in ContactsActivity class and uses address book and network components.

You can specify how many contact suggestions are displayed using the CustomTheme.setNumberOfSuggestedContacts setter.