Skip to content

changhyeon-lee/cordova-plugin-calltrap

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cordova PhoneCall Trap

It is a Apache Cordova plugin to simplify handling phone call status and events in Android devices.

Install

cordova plugin add cordova-plugin-calltrap --save

Quick Example

Register callback after deviceready

CallTrap.onCall(({state, number}) => {
  console.log(`CHANGE STATE: ${state}`)

  switch (state) {
    case CallTrap.STATE.RINGING:
      console.log('Phone is ringing', number)
      break
    case CallTrap.STATE.OFFHOOK:
      console.log('Phone is off-hook')
      break
    case CallTrap.STATE.IDLE:
      console.log('Phone is idle')
      break
  }
})

The above code is written in ES6, you could paste it here to get ES5 code.

Supported platforms

  • Android 2.3.3 or higher

References

We have tried PhoneListener but it is only compatible with PhoneGap 1.6 and does not work with new Apache Cordova versions. Also, its deployment isn't as easy as an Apache Cordova plugin should be. We are thankful for their work, though.

https://github.com/devgeeks/PhoneListener

http:https://stackoverflow.com/questions/28337385/cordova-long-running-location-service http:https://www.codeproject.com/Articles/548416/Detecting-incoming-and-outgoing-phone-calls-on-And https://github.com/renanoliveira/cordova-phone-call-trap

License

Cordova PhoneCall Trap is released under the MIT License.

About

Cordova PhoneCall Trap Plugin

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Java 84.9%
  • JavaScript 15.1%