Starting Your First App

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

Prerequisites

Platform Compatibility

The Kinvey .NET SDK is distributed through NuGet, and targets .NET Standard 2.0.

The Kinvey .NET SDK currently does not support UWP apps.

The Kinvey .NET SDK currently does not support MIC.

The Kinvey .NET SDK is currently built for single user client apps. Multi user and server-side usage is not supported.

Project Set Up

Using Visual Studio

The Kinvey .NET SDK is distributed through NuGet, and targets:

  • .NET Standard 2.0

To add the Kinvey NuGet package to your project:

  • Right click on solution in Solution Explorer
  • When the context menu opens, click on "Manage NuGet Packages for Solution..."
  • When the window to manage packages opens, search for Kinvey

Using SDK Source Code

The Kinvey .NET SDK is 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.

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.

You need to set the following arguements on your client:

  • Set your App Key and App Secret obtained from the Kinvey console.
  • (Optional) Set a Logger delegate to allow the SDK to write output. If the delegate is not set, no logs are generated.
  • (Optional) Set a file path and SQLite implementation for persisting data. If these are not set, the working directory (same folder where the application was started) is used.

Initializing a Client is usually done when your application first starts.

Client Creation

using Kinvey;

var builder = new Client.Builder(your_app_key, your_app_secret)
                        .SetFilePath(filePath) // optional
                        .setLogger(Console.WriteLine); //optional

Client kinveyClient = builder.Build();

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.

var builder = new Client
                .Builder(your_app_key, your_app_secret)
                .SetInstanceID("<Your Instance ID");

var kinveyClient = builder.Build();

Verify Set Up

You can use the PingAsync() method on the kinveyClient object to verify that the app has valid credentials.

try
{
    var response = await kinveyClient.PingAsync();
}
catch (Exception e)
{
    // an error has occured
}

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.