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.
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
In the Kinvey console, click Create an App and enter the name of your app when prompted.
You can find your key and secret in the dropdown menu in the environment sidebar.
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();
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.