iOS监听电话铃声响起,挂断的方法详解手机开发

可以监听有电话来时候的一些状态

#import <coretelephony ctcallcenter.h="">   
#import <coretelephony ctcall.h="">   
-(void)detectCall   
  {   
       CTCallCenter *callCenter = [[CTCallCenter alloc] init];   
      callCenter.callEventHandler=^(CTCall* call)   
      {   
          if (call.callState == CTCallStateDisconnected)   
          {   
              NSLog(@"Call has been disconnected");   
 
          }   
          else if (call.callState == CTCallStateConnected)   
          {   
              NSLog(@"Call has just been connected");   
          }   
 
          else if(call.callState == CTCallStateIncoming)   
          {   
              NSLog(@"Call is incoming");   
 
          }   
 
          else if (call.callState ==CTCallStateDialing)   
          {   
              NSLog(@"call is dialing");   
          }   
          else 
          {   
              NSLog(@"Nothing is done");   
          }   
      };   
  }  </coretelephony></coretelephony>

原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/5150.html

(0)
上一篇 2021年7月16日
下一篇 2021年7月16日

相关推荐

发表回复

登录后才能评论