Skip to content

Commit

Permalink
Edits to installation instructions (#745)
Browse files Browse the repository at this point in the history
* Edits to installation instructions

... including info on required Android permissions, including android.permission.BLUETOOTH.

* Edits based on review comments

And other minor edits

* List Android permissions alphabetically in the README

* Minor correction
  • Loading branch information
jeffswartz authored Apr 29, 2024
1 parent 82993bf commit 8b44b34
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 58 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

- [Update]: This version updates the Vonage Video iOS SDK version to 2.27.3. This version adds a [privacy manifest required by Apple's App store](https://developer.apple.com/support/third-party-SDK-requirements). Issue #737.

- [Update]: The installation instructions in the README file are updated, with new details on required Android permissions (such as `android.permission.BLUETOOTH`).

# 2.26.2 (April 2024)

- [Update]: This version updates the Vonage Video iOS SDK version to 2.26.3. This version adds a [privacy manifest required by Apple's App store](https://developer.apple.com/support/third-party-SDK-requirements). Issue #737.
Expand Down
126 changes: 68 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,104 +8,114 @@ This library is now officially supported by Vonage.

In this repo, you'll find the OpenTok React Native library.

## Pre-Requisites:
## Prerequisites

1. Install [node.js](https://nodejs.org/)

2. Install and update [Xcode](https://developer.apple.com/xcode/) (you will need a Mac)
2. Install and update [Xcode](https://developer.apple.com/xcode/) (you will need a Mac). (See the React Native iOS installation [instructions](https://facebook.github.io/react-native/docs/getting-started.html).)

- React Native iOS installation [instructions](https://facebook.github.io/react-native/docs/getting-started.html)
3. Install and update [Android Studio](https://developer.android.com/studio/index.html). (See the React Native Android installation [instructions](https://facebook.github.io/react-native/docs/getting-started.html).)

3. Install and update [Android Studio](https://developer.android.com/studio/index.html)
## Installation

- React Native Android installation [instructions](https://facebook.github.io/react-native/docs/getting-started.html)
1. In your terminal, change into your React Native project's directory.

## Installation:
2. Add the library using `npm` or `yarn`:

1. In your terminal, change into your React Native project's directory
* `npm install opentok-react-native`
* `yarn add opentok-react-native`

2. Add the library using `npm` or `yarn`.
### iOS Installation

- `npm install opentok-react-native`
- `yarn add opentok-react-native`
1. Install the iOS pods:

### iOS Installation
```
npx pod-install
```

**Note:** Please make sure to have [CocoaPods](https://cocoapods.org/) on your computer.
If you've installed this package before, you may need to edit your `Podfile` and project structure because the installation process has changed.
2. **For React Native versions prior to 0.60**:

1. In you terminal, change into the `ios` directory of your React Native project.
* Add this to your Podfile:

2. Create a pod file by running: `pod init`.
```
target '<YourProjectName>' do
# Pods for <YourProject>
pod 'OTXCFramework', '2.27.3'
end
```

* Run `react-native link opentok-react-native`.

**For React Native < 0.60**, add this to your Podfile:
These steps are not necessary in React Native version 0.60 and later.

```
target '<YourProjectName>' do
3. Ensure you have enabled both camera and microphone usage by adding the following entries to the `Info.plist` file:

# Pods for <YourProject>
pod 'OTXCFramework', '2.27.3'
end
```
<key>NSCameraUsageDescription</key>
<string>Your message to user when the camera is accessed for the first time</string>
<key>NSMicrophoneUsageDescription</key>
<string>Your message to user when the microphone is accessed for the first time</string>
```

```
When you create an archive of your app, the [privacy manifest settings required by Apple's App store](https://developer.apple.com/support/third-party-SDK-requirements) are added automatically with this version of the OpenTok React Native SDK.

3. Now run, `pod install`
If you try to archive the app and it fails, please do the following:

1. Go to *Target*.

4. After installing the OpenTok iOS SDK, change into your root directory of your project.
2. Click *Build Phases*.

**For React Native < 0.60**, now run `react-native link opentok-react-native`.
3. Under the *Link Binary With Libraries* section, remove `libOpenTokReactNative.a` and add it again.

5. Open `<YourProjectName>.xcworkspace` contents in XCode. This file can be found in the `ios` folder of your React Native project.
### Android Installation

6. Click `File` and `New File`
1. In your terminal, change into your project directory.

7. Add an empty swift file to your project:
2. **For React Native versions prior to 0.60**:

- You can name this file anything i.e: `OTInstall.swift`. This is done to set some flags in XCode so the Swift code can be used.
- Run `react-native link opentok-react-native`

8. Click `Create Bridging Header` when you're prompted with the following modal: `Would you like to configure an Objective-C bridging header?`
This step is not necessary in React Native version 0.60 and later.

9. Ensure you have enabled both camera and microphone usage by adding the following entries to your `Info.plist` file:
3. Run `bundle install`.

```
<key>NSCameraUsageDescription</key>
<string>Your message to user when the camera is accessed for the first time</string>
<key>NSMicrophoneUsageDescription</key>
<string>Your message to user when the microphone is accessed for the first time</string>
```
4. Make sure the following in your app's gradle `compileSdkVersion`, `buildToolsVersion`, `minSdkVersion`, and `targetSdkVersion` are greater than or equal to versions specified in the OpenTok React Native library.

If you try to archive the app and it fails, please do the following:
5. For older Android devices, add the following permissions to the `AndroidManifest.xml` file:

1. Go to Target
2. Click on Build Phases
3. Under the Link Binary With Libraries section, remove the libOpenTokReactNative.a and add it again
* `android.permission.BLUETOOTH` -- The default audio device supports
Bluetooth audio. If your app does not use the default audio device and does not
use Bluetooth, you can remove this permission.

### Android Installation
* `android.permission.BLUETOOTH_CONNECT` -- You need to enable this for API level 31 and above. If you want
to use the Bluetooth device with Android SDK DefaultAudioDevice targeting API level 31 and above, please
ask for runtime permissions in the app or enable the ("Nearby devices/Bluetooth") permission manually in
the app settings.

1. In your terminal, change into your project directory.
* `android.permission.BROADCAST_STICKY` -- We have determined that this is unused by
the OpenTok Android SDK, and we will remove this permission from an upcoming release.

2. If you have already run `react-native link opentok-react-native` for the iOS installation, please skip this step.
* `android.permission.CAMERA` -- If your app does not use the default video capturer
and does not access the camera, you can remove this permission.

- Run `react-native link opentok-react-native`
* `android.permission.INTERNET` -- Required.

3. Open your Android project in Android Studio.
* `android.permission.MODIFY_AUDIO_SETTINGS` -- If your app does not use the default audio
device and does not access the microphone, you can remove this permission.

4. Sync Gradle
* `android.permission.READ_PHONE_STATE` -- The OpenTok Android SDK requests this permission in API level 22
and lower, and 31 and above.

5. Make sure the following in your app's gradle `compileSdkVersion`, `buildToolsVersion`, `minSdkVersion`, and `targetSdkVersion` are greater than or equal to versions specified in the OpenTok React Native library.
* `android.permission.RECORD_AUDIO` -- If your app does not use the default audio
device and does not access the microphone, you can remove this permission.

6. As for the older Android devices, ensure you add camera and audio permissions to your `AndroidManifest.xml` file:
For newer versions of Android — `API Level 23` (Android 6.0) and later — you do not need to add these to your app manifest. The OpenTok React Native SDK adds them automatically. However, if you use Android 21+, certain permissions require you to prompt the user.

```xml
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.microphone" android:required="true" />
```
Your app can remove any of these permissions that will not be required. See [this post](https://stackoverflow.com/a/31616472) and [this Android documentation](https://developer.android.com/studio/build/manifest-merge). For example, this removes the `android.permission.CAMERA` permission:

Newer versions of Android–`API Level 23` (Android 6.0)–have a different permissions model that is already handled by this library.
```
<uses-permission android:name="android.permission.CAMERA" tools:node="remove"/>
```

#### Bintray sunset

Expand Down

0 comments on commit 8b44b34

Please sign in to comment.