How-To Tutorials
C#

Permissions

You can integrate the Ditto SDK into C# projects to develop for a wide range of platforms.

For a complete overview of the platforms, transports, and devices the C# SDK supports, see C#.

To install the C# SDK:

1

Confirm that you meet the minimum requirements. (Prerequisites)

2

Prepare your environment for Ditto. (Setting Up Your Environment)

3

Set up your app permissions. (Setting Up Permissions)

4

Add Ditto to your app. (Integrating Ditto)

Prerequisites

Following are the minimum requirements that must be met before attempting to install Ditto.

Installing Dependencies

Using either the NuGet package manager, .NET CLI, or adding a reference to your .csproj XML file:

NuGet Package Manager
.NET CLI
CSProj XML
Install-Package Ditto -Version 4.3.0

For the official .NET standard for Ditto, see the official NuGet reference at Packages > Ditto.

Permissions Configurations

If developing for Android or iOS targets through frameworks like Xamarin.Forms and Multi-Platform App UI (MAUI), once you've integrated the Ditto dependency in your environment, configure your permissions as appropriate.

Xamarin is a Microsoft-developed framework for building cross-platform apps using C#. Building upon Xamarin's foundation, MAUI offers additional features and various cross‑platform development improvements. For more information, see Microsoft for the official Xamarin documentation.

Setting Up Permissions

Due to both Android and iOS limiting access to some device functionality for end‑user control and privacy by default, for Ditto to function optimally and use all the network transports — Bluetooth Low Energy (LE), Local Area Network, and so on — configure your app to automatically request all necessary permissions from end users at runtime by doing the following.

Android OS
iOS

For more information on permissions requirements for Android OS, see the official Android documentation > Bluetooth permissions and Request permission to access nearby Wi-Fi.

1

Add the following permissions to your project's AndroidManifest.xml file:

The tools:targetAPI attribute ensures you avoid errors in older OS versions that do not recognize the permission.

The android:maxSdkVersion attribute ensures you avoid asking for more permissions than Ditto needs by preventing permission requests on devices running a newer OS version.

To opt out of this behavior, see step 2.

AndroidManifest.xml

2

If you want to request permissions on all OS versions, regardless of API (tools:targetAPI) and SDK levels (tools:targetAPI), add the following to override the location permission option:

AndroidManifest.xml Location Permission Override Option


Features related to runtime permissions management for Android is planned for future release.



Integrating Ditto

Integrate Ditto with your app:

For instructions on how to obtain your access credentials, see Get Started. For an introduction to authentication in Ditto, see Ditto Basics > Authentication and Initialization.

C#

C#