How to invoke our app and get the details from incoming Call? - ios

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.

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”.

Related

How to enable Ios Callkit Call Directory extension

I am trying to add the Callkit Call Directory extension to my React Native app so that I can add additional numbers that will show with caller id (populated from my app).
The Callkit documentation states:
"Before a Call Directory extension can operate on incoming calls, the user must explicitly enable the extension in the iOS Settings app."
However, there is no section for "Call blocking and identification" in my phone's settings (see here for similar issue: https://discussions.apple.com/thread/251896172)
I have tried using the openSettingsWithCompletionHandler method, which does open the settings on the phone, but still no option for "Call blocking and identification".
How can I let my app use this functionality if it cannot be seen in the phone settings? Am I doing something completely backward?
Thanks.

Make a voice call with Agora Kit

I'm using AgoraKit to build a voice call app 'VOIP' long side with CallKit.
When I'm trying to put the same channelId on 2 different devices and make join to channel, everything is going well.
What I want to do is to make the first device call the second one by defining a UID, So the second device will ring when ever the first one called it.
The problem is that I can't define a specific id for the device to call it, I looked up on Google for all the tutorials about joining a call with callKit even the code samples on Agora didn't help.
In another word, I'm trying to make the same logic as Messenger app, when ever the user call another user it should be going to ring.
Any idea would be helpful, thanks.
This is the function inside of the VoIP where you can find a unique device id. On the bases of this id you can make a call to other person.
// Handle updated push credentials
func pushRegistry(registry: PKPushRegistry!, didUpdatePushCredentials credentials: PKPushCredentials!, forType type: String!) {
// Register VoIP push token (a property of PKPushCredentials) with server
}
this is the link

Send notification to everybody but user who triggered it?

I'm using Firebase Messaging to send out notifications to users of my iPhone app. My database is structured like this:
- Users
- user1
- user2
- Groups
- group1
- members
- user1
- user2
When a user joins a group they get subscribed to a topic corresponding to that group. I have a cloud function that listens for writes in that group, and sends a notification to the groups topic when a write happens:
exports.sendNotifs = functions.database
.ref('pets/{petId}/events/{eventId}').onWrite(event => {
const pet_Id = event.params.petId;
const payload = {
'notification': {
'title': `${toTitleCase(name)} just logged an event`,
'body': `${events[eventType]} for ${toTitleCase(petName)}`,
'sound': 'default',
}
};
admin.messaging().sendToTopic(pet_Id, payload);
});
However, this results in everybody getting a notification including the person who did the write that triggered the notification. I only want other people in the group to display a notification since the triggering user doesn't need to see one. I tried appending the sending user's uid as extra data of the notification and only displaying the notification if the recieving user's uid doesn't match the notification data's uid. This works when the application is in the foreground but not if its in the background, so if the user writes then closes the application before he receives the notification it'll display for him when he receives it, something I'm trying to avoid.
How can I make sure only other members of a group get a notification? Are messaging topics not good for this?
If you use Topics it's not possible to send to everyone except one.
If you are Ok sending to everyone, and then filtering on the client, you will need to use the data messages, and not notification messages, to avoid the problem with background/foreground you described.
https://firebase.google.com/docs/cloud-messaging/concept-options
i guess that the solution is:
each iOS client from group1 will subscribe to topic /topics/group1.selfUserId
the server already have the list with all users that are part of group1
the iOS client ask server to send notification to group1.members beside selfUserId (make a http post request)
server send gets all group1.members beside selfUserId and send notification to all /topics/group1.memberX
As already mentioned, you cannot exclude someone who has been registered to a Topic.
So what you can do is sending a message to a single device. So for example you have a group of ten persons, one person posts a message, you have to send nine single messages to the other nine persons of the group.
What you need to do is to store the registration token of every single user into your database and you have to take into account that registration tokens will change after some time.

Return to sourceApplication after openUrl request is completely handled

I'm implementing an iOS app that handles a custom protocol.
Writing the method application(openURL:sourceApplication:annotation:) in my AppDelegate was easy but I'm left with a problem: I want that - once the user have done with the request - my app move to the background and send the user back to the caller sourceApplication (e.g. a browser, a QRCode reader, or any another app).
This is just like the difference between "tel:" and "telprompt:" url calls: in the former case the phone app remains active, in the latter case, after the call, the user is send back to the sourceApplication.
In order to let my app handle my custom protocol like "telprompt:" does, the only way I can think about is terminate the app once the user action is completed... but this is against iOS Human Interface Guidelines (they say "Don’t Quit Programmatically") and my app can be rejected by Apple.
On Android it is easy: you respond to an Intent with an Activity and when you call finish() on that activity the user is back to his previous app/browser/whatever.
Anyone knows a good way to achieve this on iOS?
Just to clarify:
my app don't call openUrl, it responds to openUrl requests from browser, QRCode reader, other apps;
I don't have to make phone calls;
when I handle a request I ask the user for some data, contact a server, and that's it: the interaction is finished and it would be very nice to drive the user back to previous app without let him use the home button.
I believe you should call openUrl when you are done, with the source app url in param.
That's what facebook does when you use the "connect with facebook" API.

How can I change the interface of incoming call in ios that no jailbreak

How to call the method of SpringBoard or CoreTelephony.framework without jailbreak....I want to develop a CRM(Customer Relationship Management) app that when someone calling user and he can be show the information about user's customer in calling view.
In a word...how can I show text in iPhone when the phone is ringing or calling....
BTW:↓
This app can show the incoming number's location when someone call you ,(Maybe,It's can de used in CN only..) -----> http://dx4.wishdown.com:8088/soft/360MobileSafeEnterprise_1.0.3.zip?1061501409182x1381395280x1061548127328-935a63a79c690b6b6b268ad737c10c9c
You can change the caller's photo in the address book using ABPersonSetImageData.
(That what I did in my app http://roysharon.com/CallAbout)

Resources