Getting Started

This guide shows you how to set up a project. If you are coming from any of the samples, note that (most of) these steps have already been done ahead of time.

Add an App Backend

If you don't have an account on Kinvey yet, please signup before continuing.

In the Kinvey console, create a new app backend. If you are currently viewing another app backend, click the app's name in the left navigation, and the select "New App" in the menu.

On the app dashboard page, you will find your App Key and App Secret in the top right. You’ll need those to configure your app.

Set Up the Titanium environment

If you don’t have an Appcelerator Titanium Platform account yet, sign up at Appcelerator.com. Follow the Titanium Quick Start Guide to create your first Titanium app.

Platform Compatibility

The library supports Titanium 4.x, Titanium 5.x and Titanium Alloy.

Add Kinvey SDK

You can add the Kinvey SDK to your project in one of two ways - using the package we ship, or using the source code.

Using Package

Download the library and add it to your project. Preferably, put it in a directory named app/lib. Make sure that the lib directory is located inside your app directory otherwise you might receive an error stating that the Kinvey Library is not built for arm64.

If you are using the Alloy framework, add the snippet below to app/alloy.js. The library is now globally available under Alloy.Globals.Kinvey.

var Kinvey = Alloy.Globals.Kinvey = require('kinvey-titanium-3.8.1');

If you are not using the Alloy framework, add the snippet below to Resources/app.js. The library is globally available under Kinvey.

var Kinvey = require('kinvey-titanium-3.8.1');

Using Source Code

Kinvey Javascript SDKs are now open source. If you prefer to compile your app against the SDK source code, you can follow the instructions on our github repo to set up the SDK.

Configure Your App

To use the library, you need to initialize it with your App Key and App Secret.

Kinvey.init({
  appKey: '<appKey>',
  appSecret: '<appSecret>'
});

For Dedicated Kinvey customers, you'll need to set the API host name for the library to your dedicated Kinvey host name. You can find this host name on the dashboard of the console, next to your App Key and App Secret:

Kinvey.init({
  apiHostname: 'https://<my-subdomain>-baas.kinvey.com',
  micHostname: 'https://<my-subdomain>-auth.kinvey.com'
  appKey: '<appKey>',
  appSecret: '<appSecert>'
});

Examples for apiHostname and micHostname would be:

apiHostname: 'https://kvy-us2-baas.kinvey.com'
micHostname: 'https://kvy-us2-auth.kinvey.com'

Never use the Master Secret in client-side code.

Verify Set Up

Your app is now connected to Kinvey. The ping method, as shown below, will contact the backend and verify that the SDK can communicate with your app.

var promise = Kinvey.ping().then(function(response) {
  console.log('Kinvey Ping Success. Kinvey Service is alive, version: ' + response.version + ', response: ' + response.kinvey);
}).catch(function(error) {
  console.log('Kinvey Ping Failed. Response: ' + error.description);
});

If the response just yields hello instead of hello app-name, please make sure you have configured your app. If the error yields This app backend not found, the app key and app secret you entered are incorrect.

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?