SDK Setup Guides
Java
Installing Java SDK
you can integrate the ditto sdk into kotlin projects to develop for the android platform for a complete overview of the platforms, transports, and devices the java sdk supports, see docid\ akby1jwuroyyvz6ryuoto to install the java sdk confirm that you meet the minimum requirements ( /#prerequisites ) prepare your environment for ditto ( /#setting up your environment ) set up your app permissions ( /#configuring permissions ) add ditto to your app ( /#integrating ditto ) prerequisites following are the minimum requirements that must be met before attempting to install ditto android version 6 0 (marshmallow) or later minsdk version 23 0 or later compilesdk version 31 0 or later java development kit (jdk) version 11 0 or later setting up your environment confirm that mavencentral() is in the project level build gradle bash allprojects { repositories { mavencentral() } } in the individual module build gradle file bash dependencies { // implementation "live ditto\ ditto 4 +" } configuring permissions the android operating system limits access to some device functionality for end user control and privacy to fully unlock ditto's capabilities, configure your app to automatically request all necessary permissions from end users at runtime android manifest permissions the ditto android sdk includes a set of permissions that are required to use all the device features necessary to enable sync the permissions below will be automatically merged into your app's final manifest androidmanifest xml \<manifest xmlns\ tools="http //schemas android com/tools" xmlns\ android="http //schemas android com/apk/res/android"> \<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="s" /> \<uses permission android\ name="android permission bluetooth connect" tools\ targetapi="s" /> \<uses permission android\ name="android permission bluetooth scan" android\ usespermissionflags="neverforlocation" tools\ targetapi="s" /> \<uses permission android\ name="android permission access fine location" android\ maxsdkversion="32" /> \<uses permission android\ name="android permission access coarse location" android\ maxsdkversion="30" /> \<uses permission android\ name="android permission internet" /> \<uses permission android\ name="android permission access 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 change wifi multicast state" /> \<uses permission android\ name="android permission change wifi state" /> \<uses permission android\ name="android permission nearby wifi devices" android\ usespermissionflags="neverforlocation" tools\ targetapi="tiramisu" /> the tools\ targetapi attribute causes the permission to only be requested on devices running the specified api level or higher this avoids errors on older os versions that do not recognize the permission the android\ maxsdkversion attribute causes that permission to only be requested on devices running the specified sdk level or lower this avoids asking for more permissions than ditto needs, however it will prevent your app from being able to request the permission on devices running a newer os version to opt out of this behavior and request the permission on all os versions, see the following snippet location permission override \<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 that you may need to add the xmlns\ tools="http //schemas android com/tools" namespace attribute to your app's root \<manifest> tag as shown in the androidmanifest xml example above this will configure your app's build to ignore the android\ maxsdkversion attribute in our sdk allowing the permission to be requested on any sdk version this techniquie can be used to tweak any permissions to your liking for more details, see the documentation for the https //developer android com/guide/topics/connectivity/bluetooth/permissions and https //developer android com/guide/topics/connectivity/wifi permissions permissions in the android documentation runtime permissions android requires certain permissions to be explicitly requested by the app to access features like bluetooth low energy (le) and wi fi aware to comply, configure the manifest file for your app to request permissions from end users at runtime to improve the user experience for your app, request all necessary permissions at once by calling the dittosyncpermissions helper in your activity or fragment's oncreate method void checklocationpermission() { dittosyncpermissions permissions = new dittosyncpermissions(this); string\[] missing = permissions missingpermissions(permissions requiredpermissions()); if (missing length > 0) { this requestpermissions(missing, 0); } } on android, after granting location access, ditto may not immediately recognize the permission, causing a delay in syncing to address this, whenever a relevant permission changes, call refreshpermissions() to quickly check and start syncing with the new permissions @override public void onrequestpermissionsresult(int requestcode, string\[] permissions, int\[] grantresults) { super onrequestpermissionsresult(requestcode, permissions, grantresults); this ditto refreshpermissions(); } for more information about requesting permissions in a user friendly way refer to android's documentation https //developer android com/training/permissions/requesting integrating ditto add ditto to your application we recommend placing this in your application oncreate method note that the context you want to reference here is the application level context , rather than whatever activity you might happen to be instantiating the ditto instance from initially this is because you need to ensure that your app is keeping a single ditto instance alive for the entire lifetime of the application so it's not going out of scope or getting garbage collected dittodependencies androiddependencies = new defaultandroiddittodependencies(this context); dittologger setminimumloglevel(dittologlevel debug); dittoidentity identity = new dittoidentity onlineplayground(androiddependencies, "replace me with your app id", "your playground token here"); ditto ditto = new ditto(androiddependencies, identity); try { ditto startsync(); } catch(dittoerror e) { //handle error } replace your app id and your playground token with your access credentials available in the portal for instructions on how to obtain your access credentials, see docid\ jqjyl9gbvsgi9vlw3ywvc for an introduction to authentication in ditto, see ditto basics > docid\ c802c1qiakfga2qxmcywu