Skip to content
Switch branches/tags


Failed to load latest commit information.
Latest commit message
Commit time

Smartcar Android Auth SDK Build Status Coverage Download

The SmartcarAuth Android SDK makes it easy to integrate with Smartcar Connect from Android.

Reference Documentation


Add the following to your application's build.gradle dependencies:

dependencies {
    implementation 'com.smartcar.sdk:smartcar-auth:3.0.0'
    implementation 'androidx.browser:browser:1.0.0'

Redirect URI Setup

Your application must register a custom URI scheme in order to receive Connect's response. Smartcar requires the custom URI scheme to be in the format of "sc" + clientId + "://" + hostname. This URI must also be registered in Smartcar's developer portal for your application. You may append an optional path component or TLD. For example, a redirect uri could be:


You will then need to register the URI in the AndroidManifest.xml by inserting a new activity with an intent filter. More information on the data element.

<activity android:name="com.smartcar.sdk.SmartcarCodeReceiver">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
            android:path="/callback" />


  1. Instantiate a new SmartcarAuth instance with a SmartcarCallback handler:
import com.smartcar.sdk.SmartcarAuth;
import com.smartcar.sdk.SmartcarCallback;
import com.smartcar.sdk.SmartcarResponse;

SmartcarAuth smartcarAuth = new SmartcarAuth(
    new String[] {"read_vehicle_info", "read_odometer"},

    // Create a callback to handle the redirect response
    new SmartcarCallback() {
        public void handleResponse(SmartcarResponse smartcarResponse) {
            // Retrieve the authorization code
            Log.d("SmartcarAuth", "Authorization code: " + smartcarResponse.getCode());
  1. Launch the Smartcar Connect flow:

Alternatively, add a click handler to any view to launch the Smartcar Connect flow.

Button connectButton = findViewById(;
smartcarAuth.addClickHandler(getApplicationContext(), connectButton);
  1. Use the AuthUrlBuilder for additional configuration:
String authUrl = smartcarAuth.authUrlBuilder()

// Launch Smartcar Connect with the configured parameters
smartcarAuth.launchAuthFlow(getApplicationContext(), authUrl);

// Alternatively attach a click handler
Button connectButton = findViewById(;
smartcarAuth.addClickHandler(getApplicationContext(), button, authUrl);


Please use Android Studio 3.5 to develop on the Smartcar Android SDK.