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
fix: Attempt to invoke virtual method 'void android.telephony.TelephonyManager.listen(android.telephony.PhoneStateListener, int)' on a null object reference
This package helps to detect different call states like `Incoming`, `Disconnected`, `Dialing` and `Connected` for iOS. For android, this package will give following states, `Offhook`, `Incoming`, `Disconnected` and `Missed`. In the case of `Incoming` for android, the package will also provide with the incoming phone number.
There are different hooks that you may get depending on the platform. Since for android you could also request the package to provide you with phone number of the caller, you will have to provide the necessary request message and the corresponding error callback. The package will request for `READ_PHONE_STATE` permission in android.
20
23
21
24
Its really easy to setup the package. Have a look at the following code snippet
@@ -90,56 +93,56 @@ Example project can be used to test out the package. In the example project upda
90
93
91
94
### How to run an example
92
95
93
-
1. Install `node` and `watchman`
96
+
1.Install `node` and `watchman`
94
97
95
-
```
96
-
brew install node
97
-
brew install watchman
98
+
```
99
+
brew install node
100
+
brew install watchman
98
101
99
-
```
102
+
```
100
103
101
-
2.`yarn`
104
+
2. `yarn`
102
105
103
106
Install `yarn` from `npm`.
104
107
105
108
npm i -g yarn
106
109
107
-
3. Xcode
110
+
3. Xcode
108
111
109
112
Install it from the App Store.
110
113
111
-
4. React Native Debugger
114
+
4. React Native Debugger
112
115
113
116
This is an electron app that bundles react devtools, redux devtools and chrome devtools configured for use with react-native.
114
117
115
118
brew cask install react-native-debugger
116
-
5. Once you have done all the above steps, navigate to `CallDetectionExample` folder and run `yarn` or `npm install`, it will fetch all the dependencies in the `node_modules` folder.
117
119
118
-
6. Run the packager
119
-
`npm start`
120
+
5. Once you have done all the above steps, navigate to `CallDetectionExample` folder and run `yarn` or `npm install`, it will fetch all the dependencies in the `node_modules` folder.
120
121
121
-
7. Update the mobile number of your friend in [`HomeComponent.js`](CallDetectionExample/src/HomeComponent.js)
122
+
6. Run the packager
123
+
`npm start`
122
124
125
+
7. Update the mobile number of your friend in [`HomeComponent.js`](CallDetectionExample/src/HomeComponent.js)
123
126
124
-
```javascript
125
-
callFriendTapped() {
126
-
// Add the telephone number
127
+
```javascript
128
+
callFriendTapped() {
129
+
// Add the telephone number
127
130
Linking.openURL('tel:5555555555')
128
131
.catch(err => {
129
132
console.log(err)
130
133
});
131
-
}
134
+
}
132
135
133
-
```
136
+
```
134
137
135
-
7. To run the example on iOS from terminal type
136
-
`react-native run-ios` (This will open the simulator, since simulator doesnt have the support for calling I will advice you to connect your iOS device and the follow the below procedure for running the app through xcode)
138
+
8. To run the example on iOS from terminal type
139
+
`react-native run-ios` (This will open the simulator, since simulator doesnt have the support for calling I will advice you to connect your iOS device and the follow the below procedure for running the app through xcode)
137
140
138
-
or you can also run the app from xcode, for that, open `/CallDectionExample/ios/CallDetectionExample.xcodeproj` in xcode and run on the device.
141
+
or you can also run the app from xcode, for that, open `/CallDectionExample/ios/CallDetectionExample.xcodeproj` in xcode and run on the device.
139
142
140
-
8. To run the example on android, connect any android device to your mac then follow the below steps
141
-
1. Navigate to `android` folder(./CallDectionExample/android/) folder and then run `adb reverse tcp:8081 tcp:8081`
142
-
2. Navigate back to example directory(CallDectionExample) and then run
143
-
`react-native run-android`
143
+
9. To run the example on android, connect any android device to your mac then follow the below steps
144
+
1. Navigate to `android` folder(./CallDectionExample/android/) folder and then run `adb reverse tcp:8081 tcp:8081`
145
+
2. Navigate back to example directory(CallDectionExample) and then run
0 commit comments