Install Guides
C++
you can integrate the ditto sdk into c++ projects to develop for linux and android platforms linux to install the c++ sdk fetch and extract the ditto package ( docid\ baouf6iak9wha6hrtby9g ) configure your app to link to the ditto static library ( docid\ baouf6iak9wha6hrtby9g ) downloading and unpacking ditto download ditto tar gz and unpack an archive containing the libditto a static library and ditto header linux x86 64 curl o https //software ditto live/cpp linux x86 64/ditto/4 8 2/dist/ditto tar gz && tar xvfz ditto tar gz linux aarch64 curl o https //software ditto live/cpp linux aarch64/ditto/4 8 2/dist/ditto tar gz && tar xvfz ditto tar gz linking to ditto add lditto as a compilation step in the main cpp source file for instructions on adding cross platform bluetooth low energy (le) capabilities, see docid\ gpnhy 1 kdnqahphcoxfi bluez is the official bluetooth protocol stack implementation for linux systems to communicate with other bluetooth enabled platforms linux # this command assumes \# you have unzipped the ditto tar gz in a relative directory /sdk/ \# your main code entry point is in /src/main cpp \# \# note that the list of necessary libraries to link with may vary \# by linux distribution and version g++ std=c++11 /src/main cpp i /sdk lditto ldl lrt pthread l /sdk o dist/main; \# once executed, your output will be available at /dist/main android the ditto c++ sdk for android is available in the maven central repository https //central sonatype com/artifact/live ditto/ditto cpp integrating the c++ sdk into an android app requires use of the android native development kit (ndk) and the java native interface (jni) mechanism to learn more about the ndk and jni, see https //developer android com/ndk/guides setting up your environment include the maven central repository in your gradle file, and then synchronize it with your project from your project level build gradle file located in the app's root directory, ensure the mavencentral() repository is included in the repositories section gradle allprojects { repositories { mavencentral() } } synchronize your project with the gradle file by clicking file > sync project with gradle files adding the ditto sdk dependency add the ditto sdk to your app’s build gradle file in the dependencies block with the appropriate version build gradle implementation "live ditto\ ditto cpp 4 9 3" it is also necessary to compile and build with an ndk version that is compatible with the ndk used to build the ditto sdk add this to your app's build gradle in the android section build gradle ndkversion "27 2 12479018" to ensure that your app links properly with the shared objects in the sdk, and that your app has debugging symbols for the sdk, add these rules to your android packagingoptions block build gradle jnilibs { uselegacypackaging = true keepdebugsymbols add(" / so") } pickfirst 'lib/ /libc++ shared so' pickfirst 'lib/ /libditto so' setting android context the c++ sdk for android requires that the app call ditto set android context(jnienv env, jobject context) with an application context object after creating an instance of the c++ ditto class this context is required by the sdk on android to access system resources such as network interfaces and files configuring permissions the android operating system limits access to some device functionality for end user control and privacy in order to use this functionality , configure your app to declare and request permissions from end users at runtime review permissions used by ditto ( docid\ qu1fowj 6upugzgqrduiw ) proactively check permission status to avoid unnecessary delay between granting access and ditto being able to use the feature ( docid\ qu1fowj 6upugzgqrduiw ) declar ing permissions in the android manifest android requires certain permissions to be explicitly requested by the app to access features like bluetooth low energy and wi fi aware these permissions must be declared in the app's manifest file and requested from the end user at runtime the ditto sdk's androidmanifest xml includes all of the necessary permissions for enabling its mesh network capabilities these permissions will automatically be merged with your app's permissions, so you should be aware of them androidmanifest xml \<! required for bluetooth > \<uses permission android\ name="android permission bluetooth" android\ maxsdkversion="30" /> \<uses permission android\ name="android permission bluetooth admin" android\ maxsdkversion="30" /> \<uses permission android\ name="android permission bluetooth advertise" tools\ targetapi="31" /> \<uses permission android\ name="android permission bluetooth connect" tools\ targetapi="31" /> \<uses permission android\ name="android permission bluetooth scan" android\ usespermissionflags="neverforlocation" tools\ targetapi="31" /> \<uses permission android\ name="android permission access coarse location" android\ maxsdkversion="28" /> \<! required for wifi aware > \<uses permission android\ name="android permission access wifi state" /> \<uses permission android\ name="android permission change wifi state" /> \<uses permission android\ name="android permission access network state" /> \<uses permission android\ name="android permission change network state" /> \<uses permission android\ name="android permission nearby wifi devices" android\ usespermissionflags="neverforlocation" tools\ targetapi="33" /> \<uses permission android\ name="android permission access fine location" android\ maxsdkversion="32" /> \<! required for wifi aware, tcp, udp, and websockets > \<uses permission android\ name="android permission internet" /> \<! required for mdns discovery > \<uses permission android\ name="android permission change wifi multicast state" /> some of these permissions have an android\ maxsdkversion attribute which means they are not used on devices running newer versions of android this is a best practice to respect users' privacy when those permissions are not necessary however, some apps may still need to use one or more of the above permissions across more versions of android this can be accomplished by overriding the permission configuration in your app's androidmanifest xml to override any of these permission limitations in your app, do the following open the androidmanifest xml located in the app/src/main directory of your project within the same \<manifest> tag, just before the \<application> tag, add the relevant permissions you want to configure (location example) androidmanifest xml \<uses permission android\ name="android permission access fine location" tools\ remove="android\ maxsdkversion" /> \<uses permission android\ name="android permission access coarse location" tools\ remove="android\ maxsdkversion" /> note the additional tools\ remove attribute this tells the manifest merger to selectively remove the android\ maxsdkversion behavior from the associated permissions, changing them to apply to all android versions for more information, see the official https //developer android com/guide/topics/permissions/overview and https //developer android com/build/manage manifests documentation requesting permissions at runtime at runtime, your app can call the c++ ditto missing permissions() function to get a list of permissions required by ditto that are missing, and your app can request them importing ditto from the source code of your app, add #include \<ditto h> and provide your access credentials auto identity = identity onlineplayground("your app id", "playground token", true); try { ditto ditto = ditto(identity, dir); ditto set minimum log level(loglevel debug); ditto start sync(); } catch (const dittoerror \&err) { }