# Miscellaneous ## Adding the Sinch library to React Native application With an extra layer of [NativeModule](https://reactnative.dev/docs/native-platform), you can embed the Sinch Android library into your React Native application. Note that by doing this the SDK will only work on React Native apps running on Android devices. To support other platforms you'll need to implement a NativeModule for each platform separately (including platform-specific Sinch SDKs). To add the Sinch library to a React Native application: 1. Copy the Sinch library `.aar` file to `your-react-native-app/android/app/libs/` (create the `libs` folder if needed). 2. Edit `your-react-native-app/android/app/build.gradle` and add `implementation fileTree(dir: "libs", include: ["*.aar"])` under `dependencies`. 3. To access the Sinch SDK API from React Native, follow the [Android Native Module Guide](https://reactnative.dev/docs/turbo-native-modules-introduction). Example `SinchModule` to start a client for a given user ID: ```java public class SinchModule extends ReactContextBaseJavaModule implements SinchClientListener { static final String APP_KEY = ""; static final String APP_SECRET = ""; static final String ENVIRONMENT = "ocra.api.sinch.com"; private Handler mainThreadHandler = new Handler(Looper.getMainLooper()); private static final String TAG = SinchModule.class.getSimpleName(); private SinchClient mSinchClient; private String mUserId; public SinchModule(@Nullable ReactApplicationContext reactContext) { super(reactContext); } @NonNull @Override public String getName() { return "SinchModule"; } @ReactMethod public void createClient(String userId) { mainThreadHandler.post(() -> { mUserId = userId; mSinchClient = SinchClient.builder() .context(getReactApplicationContext()) .userId(userId) .applicationKey(APP_KEY) .environmentHost(ENVIRONMENT) .build(); mSinchClient.addSinchClientListener(this); mSinchClient.start(); Log.d(TAG, "Starting SinchClient"); }); } @Override public void onClientStarted(SinchClient sinchClient) { Log.d(TAG, "onClientStarted called"); } @Override public void onClientFailed(SinchClient sinchClient, SinchError sinchError) { Log.e(TAG, "onClientFailed called: " + sinchError.getMessage()); } @Override public void onLogMessage(int i, String s, String s1) { } @Override public void onPushTokenRegistered() { Log.d(TAG, "onPushTokenRegistered called"); } @Override public void onPushTokenRegistrationFailed(SinchError sinchError) { Log.e(TAG, "onPushTokenRegistrationFailed called: " + sinchError.getMessage()); } @Override public void onCredentialsRequired(ClientRegistration clientRegistration) { clientRegistration.register(JWT.create(APP_KEY, APP_SECRET, mUserId)); } @Override public void onUserRegistered() { Log.d(TAG, "onUserRegistered called"); } @Override public void onUserRegistrationFailed(SinchError sinchError) { Log.e(TAG, "onUserRegistrationFailed called: " + sinchError.getMessage()); } } ``` After [registering the module](https://reactnative.dev/docs/turbo-native-modules-introduction#4-write-your-native-platform-code) you can call `createClient` from JavaScript: ```javascript const { SinchModule } = NativeModules; const MainScreen = ({ navigation }) => { const onPress = () => { SinchModule.createClient('myUserId'); }; return (