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+.
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
The following fields in the configuration must be set:
clientIDThe client's id
clientSecretThe client's private secret
appURLSchemeThe app URL scheme
serverURLThe SPiD server to connect to
contextThe 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" />
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
- Getting started
- Self Service
- Mobile review checklist
- OAuth for mobile clients
- Best practices
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).
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.