You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After install, you can use `rnpm` (`npm install rnpm -g`) to link android.
40
-
use `rnpm link react-native-incall-manager` to link or manually if you like.
42
+
use `react-native link react-native-incall-manager` to link or manually if you like.
41
43
42
44
We use android support library v4 to check/request permissions.
43
45
You should add `compile "com.android.support:support-v4:23.0.1"` in `$your_project/android/app/build.gradle` dependencies on android.
44
46
45
-
#### Manually Link
47
+
#### Manually Linking
46
48
47
-
if rnpm link doesn't work. ( see: https://github.com/zxcpoiu/react-native-incall-manager/issues/21#issuecomment-279575516 )
48
-
please add it manually in your main project:
49
+
If `react-native link` doesn't work, ( see: https://github.com/zxcpoiu/react-native-incall-manager/issues/21#issuecomment-279575516 ) please add it manually in your main project:
49
50
50
-
1.in`android/app/build.gradle`
51
-
should have a line `compile(project(':react-native-incall-manager'))` in `dependencies {}` section
51
+
1.In`android/app/build.gradle`
52
+
Should have a line `compile(project(':react-native-incall-manager'))` in `dependencies {}` section
52
53
53
-
2.in`android/settings.gradle`
54
-
should have:
54
+
2.In`android/settings.gradle`
55
+
Should have:
55
56
```
56
57
include ':react-native-incall-manager'
57
58
project(':react-native-incall-manager').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-incall-manager/android')
since ios part written in swift and it doesn't support static library yet.
91
-
before that, you should add this project manually
92
-
please do it step by step carefully :pray: :
91
+
`react-native link react-native-incall-manager`
93
92
94
-
#### Add files in to your project:
93
+
#### Manually Linking
95
94
96
-
1. Open your project in xcode
97
-
2. find your_project directory under your project's xcodeproject root. ( it's a sub-directoory, not root xcodeproject itself )
98
-
3. you can do either:
99
-
(recommended) directly drag your node_modules/react-native-incall-manager/ios/RNInCallManager/ into it.
100
-
(may have some [path issue](https://github.com/zxcpoiu/react-native-incall-manager/issues/39)) right click on your_project directory, `add files` to your project and add `node_modules/react-native-incall-manager/ios/RNInCallManager/`
101
-
4. on the pou-up window, uncheck `Copy items if needed` and select `Added folders: Create groups` then add it. you will see a new directory named `RNInCallmanager under your_project` directory.
102
-
103
-
#### Setup Objective-C Bridging Header:
104
-
1. click your `project's xcodeproject root`, go to `build setting` and search `Objective-C Bridging Header`
105
-
2. set you header location, the default path is: `ReactNativeProjectRoot/ios/`,
106
-
in this case, you should set `../node_modules/react-native-incall-manager/ios/RNInCallManager/RNInCallManager-Bridging-Header.h`
107
-
108
-
### Swift:
109
-
Make sure you set swift version to `3.2`: 
95
+
In case `react-native link` doesn't work,
110
96
97
+
- Drag `node_modules/react-native-incall-manager/ios/RNInCallManager.xcodeproj` under `<your_xcode_project>/Libraries`
- In `Header Search Paths`, add `$(SRCROOT)/../node_modules/react-native-incall-manager/ios/RNInCallManager`
111
102
112
103
#### Clean project if messed up:
104
+
113
105
The installation steps are a bit complex, it might related your xcode version, xcode cache, converting swift version, and your own path configurations. if something messed up, please folow steps below to clean this project, then do it again steps by steps.
114
106
115
-
1. delete all project/directory in xcode related to incall-manager
116
-
2. delete `react-native-incall-manager` in node_modules ( rm -rf )
107
+
1. Delete all project/directory in xcode related to incall-manager
108
+
2. Delete `react-native-incall-manager` in node_modules ( rm -rf )
117
109
3. Xcode -> Product -> clean
118
-
4. close xcode
119
-
5. npm install again
120
-
6. open xcode and try the install process again steps by steps
110
+
4. Close xcode
111
+
5. Run `npm install` again
112
+
6. Open xcode and try the install process again steps by steps
121
113
122
-
if someone knows a simpler way to set this project up, let me know plz.
114
+
If someone knows a simpler way to set this project up, let me know plz.
123
115
124
-
#### optional sound files on android
116
+
#### Optional sound files on iOS
125
117
126
-
if you want to use bundled ringtone/ringback/busytone sound instead of system sound
118
+
If you want to use bundled ringtone/ringback/busytone sound instead of system sound
127
119
128
-
1. add files into your_project directory under your project's xcodeproject root. ( or drag into it as described above. )
129
-
2. check `copy file if needed`
130
-
3. make sure filename correspond to sound type:
120
+
1. Add files into your_project directory under your project's xcodeproject root. ( or drag into it as described above. )
121
+
2. Check `copy file if needed`
122
+
3. Make sure filename correspond to sound type:
131
123
132
124
```
133
125
incallmanager_busytone.mp3
134
126
incallmanager_ringback.mp3
135
127
incallmanager_ringtone.mp3
136
128
```
137
129
138
-
on ios, we only support mp3 files currently.
130
+
On ios, we only support mp3 files currently.
139
131
140
132
## Usage:
141
133
@@ -155,7 +147,7 @@ InCallManager.stop();
155
147
// ... it will also remote event listeners ...
156
148
```
157
149
158
-
if you want to use ringback:
150
+
If you want to use ringback:
159
151
160
152
```javascript
161
153
// ringback is basically for OUTGOING call. and is part of start().
@@ -165,7 +157,7 @@ InCallManager.start({media: 'audio', ringback: '_BUNDLE_'}); // or _DEFAULT_ or
165
157
InCallManager.stopRingback();
166
158
```
167
159
168
-
if you want to use busytone:
160
+
If you want to use busytone:
169
161
170
162
```javascript
171
163
// busytone is basically for OUTGOING call. and is part of stop()
@@ -174,7 +166,7 @@ if you want to use busytone:
174
166
InCallManager.stop({busytone:'_DTMF_'}); // or _BUNDLE_ or _DEFAULT_
175
167
```
176
168
177
-
if you want to use ringtone:
169
+
If you want to use ringtone:
178
170
179
171
```javascript
180
172
// ringtone is basically for INCOMING call. it's independent to start() and stop()
@@ -192,8 +184,8 @@ InCallManager.stop();
192
184
193
185
```
194
186
195
-
also can interact with events if you want:
196
-
see API section.
187
+
Also can interact with events if you want:
188
+
See API section.
197
189
198
190
```javascript
199
191
import { DeviceEventEmitter } from'react-native';
@@ -207,7 +199,7 @@ DeviceEventEmitter.addListener('Proximity', function (data) {
207
199
## About Permission:
208
200
209
201
210
-
since version 1.2.0, two functions and a property were added:
202
+
Since version 1.2.0, two functions and a property were added:
211
203
212
204
```javascript
213
205
// --- function
@@ -255,7 +247,7 @@ Step 2: override `onRequestPermissionsResult` in your `MainActivity.java` like:
255
247
}
256
248
```
257
249
258
-
then you can test it on android 6 now.
250
+
Then you can test it on android 6 now.
259
251
260
252
**Another thing you should know is:**
261
253
@@ -264,29 +256,29 @@ So in **development mode**, you should manually grant permission in `app setting
264
256
You don't have to do this in **release mode** since there are no red box.
265
257
266
258
267
-
checkout this awesome project: [react-native-android-permissions](https://github.com/lucasferreira/react-native-android-permissions) by @lucasferreira for more information.
259
+
Checkout this awesome project: [react-native-android-permissions](https://github.com/lucasferreira/react-native-android-permissions) by @lucasferreira for more information.
268
260
269
261
270
262
## Automatic Basic Behavior:
271
263
272
-
**on start:**
273
-
*store current settings, set KeepScreenOn flag = true, and register some event listeners.
274
-
*if media type is `audio`, route voice to earpiece, otherwise route to speaker.
275
-
*audio will enable proximity sensor which is disabled by default if media=video
276
-
*when proximity detect user closed to screen, turn off screen to avoid accident touch and route voice to earpiece.
277
-
*when newly external device plugged, such as wired-headset, route audio to external device.
278
-
*optional play ringback
264
+
**On start:**
265
+
*Store current settings, set KeepScreenOn flag = true, and register some event listeners.
266
+
*If media type is `audio`, route voice to earpiece, otherwise route to speaker.
267
+
*Audio will enable proximity sensor which is disabled by default if media=video
268
+
*When proximity detect user closed to screen, turn off screen to avoid accident touch and route voice to earpiece.
269
+
*When newly external device plugged, such as wired-headset, route audio to external device.
270
+
*Optional play ringback
279
271
280
-
**on stop:**
272
+
**On stop:**
281
273
282
-
*set KeepScreenOn flag = false, remote event listeners, restore original user settings.
283
-
*optional play busytone
274
+
*Set KeepScreenOn flag = false, remote event listeners, restore original user settings.
275
+
*Optional play busytone
284
276
285
277
## Custom Behavior:
286
278
287
-
you can custom behavior use API/events exposed by this module. see `API` section.
279
+
You can custom behavior use API/events exposed by this module. see `API` section.
0 commit comments