iOS Question How to read missed calls or check phone state?

Discussion in 'iOS Questions' started by susu, Jul 24, 2015.

  1. susu

    susu Well-Known Member Licensed User

  2. susu

    susu Well-Known Member Licensed User

    I hate to call your name but please help me @Erel - The Ultimate!
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    It will only allow you to monitor the phone state when your app is in the foreground. What exactly are you trying to implement?
     
  4. susu

    susu Well-Known Member Licensed User

    I need to verify user's phone number by make a call to him. If I can detect phone state and check it's my phone number calling, I can approve him.
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    You can use this code to listen for incoming calls:
    Code:
    Private Sub Application_Start (Nav As NavigationController)
       NavControl = Nav
       Page1.Initialize(
    "Page1")
       NavControl.ShowPage(Page1)
       Page1.RootPanel.LoadLayout(
    "1")
       
    Dim no As NativeObject = Me
       no.RunMethod(
    "ListenForCalls"Null)
    End Sub

    Sub State_Changed(call As Object)
       
    Log("call: " & call)
    End Sub

    #if objc
    #import <CoreTelephony/CTCallCenter.h>
    - (void)ListenForCalls {
       static CTCallCenter* cc;
       cc = [[CTCallCenter alloc] init];
       [cc setCallEventHandler: ^(CTCall* call) {
      [self.bi raiseEvent:nil event:@"state_changed:" params:@[call]];
      }];
    }
    #end if
    However it will not include the phone number. This information is not available:
    https://developer.apple.com/library...etworkingInternet/Reference/CTCall/index.html
     
  6. susu

    susu Well-Known Member Licensed User

    Thanks Erel.
    You mean there's no way to read call log or incoming call?
     
  7. JanPRO

    JanPRO Well-Known Member Licensed User

  8. susu

    susu Well-Known Member Licensed User

    I read about it but you only can read it when you backup that database to computer. I need to read call log inside iOS.
    After some search on Google, I think it's unpossible to read call log or even know who is calling. So I need to ask user input the missed call number manually.
    Ps: That's why iOS suck! :D
     
Loading...