Reputation: 805
If any number is saved in my application and That user call me on my iPhone then I want to invoke my application with screen where user can fill the information about that calls.(Like Call duration,Caller Name and Some application specific details)
Please guide me how to achieve log a call in iOS. I am not sure that Apple allow us to get the information about the call which is done by normal dialer not by my application.
I have find this link : Call history, SMS history, Email history in iOS But I want to invoke my application on incoming call if that user contact number is saved in my application.
Please help me or suggest me the solution or whether it is feasible or not.
Upvotes: 2
Views: 3260
Reputation: 3647
iOS 10 +:
Use Callkit, and check it out call directory extension
Below method is called : Only when the system launches the app extension and not for each individual call, you must specify call identification information all at once; you cannot, for example, make a request to a web service to find information about an incoming call.
Use the addIdentificationEntry(withNextSequentialPhoneNumber:label:)
method.
class CustomCallDirectoryProvider: CXCallDirectoryProvider {
override func beginRequest(with context: CXCallDirectoryExtensionContext) {
let labelsKeyedByPhoneNumber: [CXCallDirectoryPhoneNumber: String] = [ … ]
for (phoneNumber, label) in labelsKeyedByPhoneNumber.sorted(by: <) {
context.addIdentificationEntry(withNextSequentialPhoneNumber: phoneNumber, label: label)
}
context.completeRequest()
}
}
According to Apple:
Identifying Incoming Callers When a phone receives an incoming call, the system first consults the user’s contacts to find a matching phone number. If no match is found, the system then consults your app’s Call Directory extension to find a matching entry to identify the phone number. This is useful for applications that maintain a contact list for a user that’s separate from the system contacts, such as a social network, or for identifying incoming calls that may be initiated from within the app, such as for customer service support or a delivery notification. For example, consider a user who is friends with Jane in a social networking app, but who doesn’t have her phone number in their contacts. The social networking app has a Call Directory app extension, which downloads and add the phone numbers of all of the user’s friends. Because of this, when the user gets an incoming call from Jane, the system displays something like “(App Name) Caller ID: Jane Appleseed” rather than “Unknown Caller”.
Upvotes: 3