我想用ionic v4中的号码检测呼入和呼出电话。
我已经尝试过该插件(cordova-phone-call-trap https://github.com/renanoliveira/cordova-phone-call-trap),但无法正常工作。
phonecalls() {
PhoneCallTrap.onCall(function (state) {
//alert("CHANGE STATE: " + state);
//var callObj = JSON.parse(state),
///state = callObj.state,
console.log(state);
this.callingNumber = state.number;
//alert("callingNumber STATE: " + this.callingNumber);
switch (state) {
case "RINGING":
console.log("Phone is ringing");
this.callStatus = "Phone is ringing";
break;
case "OFFHOOK":
console.log("Phone is off-hook");
this.callStatus = "Phone is off-hook";
break;
case "IDLE":
console.log("Phone is idle");
this.callStatus = "Phone is idle";
break;
}
});
}