Android SDK

The Android SDK is built on top of the backend SDK to provide access to functions with minimal effort from the developer. Connecting to the SPiD can be done either natively, using a WebView, browser or connecting via Facebook or Google+.

SPiDClient

All communication with SPiD goes through the SPiDClient class, which is implemented as a singleton. The singleton instance is instantiated automatically, but before it can be used it must be configured with a call to SPiDClient.configure(SPiDConfiguration config).

The following fields in the configuration must be set:

  • clientID The client's id
  • clientSecret The client's private secret
  • appURLScheme The app URL scheme
  • serverURL The SPiD server to connect to
  • context The application context

An example configuration how to configure the SPiDClient would be

SPiDConfiguration config = new SPiDConfigurationBuilder(getApplicationContext(),
	SPiDEnvironment.SWEDISH_STAGE,
    "your-client-id",
    "your-client-secret",
    "app-url-scheme")
    .debugMode(true)
    .build();
SPiDClient.getInstance().configure(config);

Be sure to update your AndroidManifest.xml to set your url scheme as follows in the intent-filter where you wish your redirect to be caught

<data android:scheme="your-url-scheme" />

Connecting to SPiD

The recommended way to connect to SPiD is to use a browser, see explanation why. However it can be done a number of ways, which is explained in greater detail below.

Connecting via browser (add Custom Chrome tabs example)

TODO: Add flow diagrams?

Connecting via webview

Connecting via native

Connecting via Google+

Connecting via Facebook

Native mobile development

Help us improve

Did you spot an error? Or maybe you just have a suggestion for how we can improve? Leave a comment, or better yet, send us a pull request on GitHub to fix it (in-browser editing, only takes a moment).

History of this page

Comments/feedback

Do you have questions, or just want to contribute some newly gained insight? Want to share an example? Please leave a comment. SPiD reads and responds to every question. Additionally, your experience can help others using SPiD, and it can help us continuously improve our documentation.