This article provides instructions on adding and integrating Ditto to your React Native project, ensuring successful syncing.
package.json
file:
app.json
or app.config.js
, depending on your project’s configuration:
minSdkVersion
24
expo-build-properties
to ensure compatibility. Add the following to app.json
or app.config.js
:
app.json
or app.config.js
.Info.plist
.ios/Podfile
file in your project, set the minimum deployment target for iOS:min_ios_version_supported
set to 14.Info.plist
file, add the following key-value pairs:Info.plist
as source code, right-click the file from the left sidebar in Xcode > click Open As > and then select Source Code from the menu.24
or higher:build.gradle
located in the android
root directory.minSDKVersion
to 24
.android/gradle.properties
.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.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:AndroidManifest.xml
located in the app/src/main
directory of your project.<manifest>
tag, just before the <application>
tag, add the relevant permissions you want to configure (location example):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.build.gradle
located in the android/app
directory:App
), use this helper function to request permissions if developing for the Android target:
onlinePlayground
— Explore platform features and functionality without setting up your authentication mechanism.onlineWithAuthentication
— If developing a production-level app, integrate your own identity provider, such as Auth0, identify users, give users read or write control, and integrate with your existing authentication systems.onlineWithAuthentication
identity when developing a production app for deployment.
try/catch
statement, instantiate a new Ditto
object with the identity you’ve specified:
TransportConfig
instance, do the following to set up transport configurations in your app:
document
), creates a subscription for the Cars
collection, executes database operations and logs the results, registers an observer for watching changes in the Cars
collection:
Debug
:
AndroidManifest.xml
:
small_app_icon
drawable must be monochrome white.
The foreground service will be automatically started and stopped on startSync()
and stopSync()
, respectively.