# First Time Setup Follow this step-by-step guide to set up the Sinch Voice and Video SDK for the first time. ## Register an Application 1. Register a Sinch Developer account [here](https://dashboard.sinch.com/signup). 2. Setup a new Application using the Dashboard where you can then obtain an *Application Key* and an *Application Secret*. ## Download The Sinch SDK can be downloaded [here](/docs/in-app-calling/sdk-downloads). It contains: the library *aar*, this user guide, reference documentation, and sample apps for calling. ## Add the Sinch library The Sinch SDK library is distributed in [AAR](http://tools.android.com/tech-docs/new-build-system/aar-format) format. To use it in your project either: > - Copy the **.aar** file to the `libs` folder and edit the build.gradle file to include ```text repositories { flatDir { dirs 'libs' } } dependencies { implementation(name:'sinch-android-rtc', version:'+', ext:'aar') } ``` > - Or using Android Studio choose `File -> New -> New Module -> Import .JAR/.AAR Package` option ## Running ProGuard If you are using ProGuard, we bundle an example proguard-project.txt file that makes sure that the Sinch SDK will work as expected. ## Permissions A minimum set of permissions are needed for the app to use the Sinch SDK. These are specified in the `AndroidManifest.xml` file. ```xml ``` By default, the Sinch SDK hangs up any Sinch call if the regular phone app has an active call. This functionality requires the permission READ_PHONE_STATE. However, if this default functionality isn’t wanted, turn it off by calling [SinchClient.callController.setRespectNativeCalls(false)](https://download.sinch.com/android/latest/reference/com/sinch/android/rtc/SinchClient.html#getCallController()) and the permission READ_PHONE_STATE is not needed. If you intend to use `Automatic Audio Routing` (see the appropriate section in the [Voice Calling](/docs/in-app-calling/android/calling)), you have to provide `android.Manifest.permission.BLUETOOTH` in the manifest and manually check that this permission is granted by the user. ## Verify Manifest in Runtime To verify that the manifest has the necessary permissions the [SinchClient.checkManifest()](https://download.sinch.com/android/4.11.7/reference/com/sinch/android/rtc/SinchClient.html#getCallClient())` can also be used to check whether required permissions are granted by the user in runtime. An example of how to dynamically request missing permissions can be found in the sample applications that comes with the SDK. *Note:* This method takes into consideration the features which were enabled for the app (for example, calling, respecting native calls). Call `SinchClient.checkManifest()` after the setup but before the start of the SinchClient. ## 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, however, that by doing this the SDK will only work on React Native apps running on Android devices. In order to be able to work with other platforms you'll have to implement a NativeModule for each of these platforms separately (including different 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 it isn't there already). 2. Locate the `your-react-native-app/android/app/build.gradle/` file. Find the `dependencies` section there and add `implementation fileTree(dir: "libs", include: ["*.aar"])` entry. 3. To be able to access the Sinch SDK API from within your React Native application follow the [Android Native Module Guide](https://reactnative.dev/docs/turbo-native-modules-introduction) on the official React Native developer portal. The following code sample is a very basic example of a `SinchModule` that would allow a user with a given ID to be logged into the SDK: ```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 = Sinch.getSinchClientBuilder().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 that module](https://reactnative.dev/docs/turbo-native-modules-introduction#4-write-your-native-platform-code) you will be able to call `createClient` method from your JavaScript code like this: ```javascript const { SinchModule } = NativeModules; const MainScreen = ({ navigation }) => { const onPress = () => { SinchModule.createClient('myUserId'); }; return (