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/tech/app/5150.html

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

相关推荐

发表回复

登录后才能评论

WordPress 数据库错误: [Duplicate entry '80-d16c1647a53da3ad6bbb3d1108156ba7' for key 'task_id_source_url_key']
insert into wp_autoblog_queue(task_id,source_url,source_url_key,create_date_time,not_check_stoped,post_interval) values(80,'https://pythonjishu.com/robotic-process-automation/','d16c1647a53da3ad6bbb3d1108156ba7',1735122360,0,0)