【发布时间】:2019-09-05 10:29:44
【问题描述】:
我试图捕捉电话接听事件,甚至可以使用 react-native 吗?
此时我正在使用https://github.com/priteshrnandgaonkar/react-native-call-detection。在通话开始时,我捕捉到了摘机事件,这很好,但我真的需要捕捉电话接听事件。
感谢所有帮助和提示。谢谢!
startListenerTapped() {
this.callDetector = new CallDetectorManager((event)=> {
// For iOS event will be either "Connected",
// "Disconnected","Dialing" and "Incoming"
// For Android event will be either "Offhook",
// "Disconnected", "Incoming" or "Missed"
if (event === 'Disconnected') {
// Do something call got disconnected
}
else if (event === 'Connected') {
// Do something call got connected
// This clause will only be executed for iOS
}
else if (event === 'Incoming') {
// Do something call got incoming
}
else if (event === 'Dialing') {
// Do something call got dialing
// This clause will only be executed for iOS
}
else if (event === 'Offhook') {
//Device call state: Off-hook.
// At least one call exists that is dialing,
// active, or on hold,
// and no calls are ringing or waiting.
// This clause will only be executed for Android
}
else if (event === 'Missed') {
// Do something call got missed
// This clause will only be executed for Android
}
},
【问题讨论】:
标签: android ios react-native mobile phone-call