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

susu

Well-Known Member
Licensed User
Longtime User
I hate to call your name but please help me @Erel - The Ultimate!
 
Upvote 0

susu

Well-Known Member
Licensed User
Longtime 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.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use this code to listen for incoming calls:
B4X:
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
 
Upvote 0

susu

Well-Known Member
Licensed User
Longtime User
Thanks Erel.
You mean there's no way to read call log or incoming call?
 
Upvote 0

JanPRO

Well-Known Member
Licensed User
Longtime User
Upvote 0

susu

Well-Known Member
Licensed User
Longtime 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
 
Upvote 0
Top