New to Kinvey? Get started today with this tutorial or attend our getting started webinar.

Starting Your First App

If you are starting with a fresh Android project or an existing app, follow these steps to add the Kinvey Android library to your app and set up the Kinvey Client.


The Kinvey Android SDK supports Android versions based on a combination of API level usage and age. As per the current Kinvey policy, we do not support versions that are older than 3 years and exhibit less than 10% usage based on the Android Distribution Dashboard

Manual Project Set Up

Android Studio

  1. In Android Studio, create a new Android project: File → New Project. The Application Name will be displayed to users, and the Module Name is used internally with Android Studio. Specify a package name ("com.myApp"), and set the Minimum SDK level to API 15 or greater. Set the Target SDK to your preferred platform level, and finally Compile With the highest API level available.
  2. Download the latest Kinvey library (zip) and extract the downloaded zip file.
  3. Within Android Studio, right click on your project and select Reveal In Finder (OSX) or Reveal in Explorer (Windows)
  4. In the window that opens, navigate to the directory MyApplicationName/app/libs. If the libs directory does not exist, create it.
  5. Copy all JAR files and AAR files, from the lib/ folder of the extracted Kinvey library zip into the MyApplicationName/app/libs folder you opened in the previous step.
  6. Expand Gradle Scripts in the Project Window, and select build.gradle(Module:app). Note this is NOT the Top-level build file.
  7. Modify the dependencies and the repositories section, leaving any existing dependencies and repositories in place.
buildscript {
  repositories {
    jcenter() // or mavenCentral()

dependencies {
    classpath ''

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  compile ':kinvey-android:+@aar'
  compile ':relinker:+@aar'
  compile ':realm-android-library:+@aar'
  1. Expand Gradle Scripts in the Project Window, and select build.gradle(Project:MyApplicationName). Note this is the Top-level build file.
  2. Modify the allprojects section, leaving any existing dependencies and repositories in place.
allprojects {
  repositories {
    flatDir {
      dirs './libs'

Add an App Backend

Start with signing up if you don't have an account with Kinvey yet.

In the Kinvey console, click Create an App and enter the name of your app when prompted.

Add an app in Console

You can find your key and secret in the dropdown menu in the environment sidebar.

Key and secret

Copy the key and secret when performing the next steps.

Initialize a Client

The Client.Builder is used to build and initialize the Client before making any calls to the Kinvey API.

The Client.Builder requires the App Key and App Secret obtained from the Kinvey console, as well as your Android Application context. Initializing a Client is usually done within your Application.


public class App extends Application {

    private Client mKinveyClient;

    public void onCreate() {
        mKinveyClient = new Client.Builder(your_app_key, your_app_secret, this).build();

    public Client getKinveyClient(){
        return mKinveyClient;


Customers with dedicated Kinvey instances and Progress Health Cloud customers need to set their dedicated Kinvey instance ID on the Client.

You can find your Instance ID on the dashboard of the Kinvey Console, next to your App Key and App Secret.

mKinveyClient = new Client.Builder(your_app_key, your_app_secret
    , this).setInstanceID("<Your Instance ID>").build();

You must use .properties file initialization to enable push notifications. See Using a properties file for details.

After initializing Client, you can use Client.sharedInstance() to get a Client instance from anywhere inside your app.

Using a properties file

Hard-wiring the appKey and appSecret programmatically is a handy way for you to initialize the Kinvey library. However, this is not always the best choice. Often times you may want more control over the library configuration and would prefer to keep it in a separate .properties file.

Store properties inside the file in your project's assets folder:

# Required settings
app.key=<Your App Key>
app.secret=<Your App Secret>

# Optional settings
#### Required for push
gcm.senderID=<Your Sender ID>

#### Required for Dedicated Kinvey customers<Your Instance ID>

In order to initialize Client with the properties file settings you need to call a different constructor method on the Client.Builder class, then call build().

mKinveyClient = new Client.Builder(this).build();

Verify Set Up

You can use…) to verify that the app has valid credentials. The following code example:

  • builds a new client
  • pings the backend with the app credentials
mKinveyClient = new Client.Builder(appKey, appSecret, this.getApplicationContext()).build(); KinveyPingCallback() {

    public void onFailure(Throwable t) {
        Log.e(TAG, "Kinvey Ping Failed", t);

    public void onSuccess(Boolean b) {
        Log.d(TAG, "Kinvey Ping Success");

Under most circumstances, the asynchronous API is what you want. You can use the synchronous API if you want fine-grained control over the execution of a particular service. If you use the synchronous blocking API, wrap all requests in asynchronous threads so as not to block Android's UI thread.

Every App has an Active User

Your app will be used by a real-life human being. This person is represented by the Active User. This user object must explicitly be created, either with a username and password, OAuth sign-on (such as Facebook, Google+, LinkedIn, etc.), or Mobile Identity Connect. See the User Guide for more information.

What's next

You are now ready to start building your awesome apps! Next we recommend diving into the User Guide or Data Store Guide to learn more about our service, or explore the sample apps to go straight to working projects.

Got a question?