I want that there be a broad cast receiver which has been registered inside class activity, and as soon as New SMS comes to my phone then that activity should be call, where i can also abord this broad cast receiver.
You have to register new Broad Cast receiver in your activity.
Related
I'm trying to get caller ID (phone number) at the time of incoming call.
TrueCaller has implemented this and they get the phone number of incoming caller.
I've found this information:
1. CoreTelephony Framework(It gives only calling states)
2. Apple's 9.0 update : "Maybe" contacts sync. with mail app and detects the incoming phone number.
###EDIT###
iOS 10 and above:
Use Callkit, take a look at call directory extension
According to documentation,
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 doesn’t have her phone number in her contacts. The social networking app has a Call Directory 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”.
To provide identifying information about incoming callers, you use the addIdentificationEntry(withNextSequentialPhoneNumber:label:) method in the implementation of beginRequest(with:).
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()
}
}
Because this 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.
iOS 9 and earlier:
As Kakshil mentioned, Caller ID is not possible on non jailbroken devices.
And I will give you some findings on how true caller works,
Its not reading the call history, they actually created Action
extension, wherever you try to share a contact, it will display
truecaller app extension, which coded for showing the contact
details fetched from their server
You might also get confused with push notification received for few
calls, saying
"Some X calls you". This is where truecaller used a trick. If you
noticed clearly, that push notification will be received only when
you get a call from an android user with truecaller installed. Let
me explain you in details,
X(android user with truecaller installed), calling Y(ios user with truecaller installed), the android version notify the server that X making call to Y. And server will send push notification to Y's iPhone.
Caller ID is not possible on non jailbroken devices.
However there is one way, in which you can know which user is calling, but not sure if it will be useful to you.
If you have a bluetooth device, connected to the iPhone, it will get all notifications, including incoming calls, which you can then get the caller ID for.
Apart from this, there is currently no other way at all to know the called ID.
I'm trying to get caller ID (phone number) at the time of incoming call.
TrueCaller has implemented this and they get the phone number of incoming caller.
I've found this information:
1. CoreTelephony Framework(It gives only calling states)
2. Apple's 9.0 update : "Maybe" contacts sync. with mail app and detects the incoming phone number.
###EDIT###
iOS 10 and above:
Use Callkit, take a look at call directory extension
According to documentation,
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 doesn’t have her phone number in her contacts. The social networking app has a Call Directory 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”.
To provide identifying information about incoming callers, you use the addIdentificationEntry(withNextSequentialPhoneNumber:label:) method in the implementation of beginRequest(with:).
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()
}
}
Because this 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.
iOS 9 and earlier:
As Kakshil mentioned, Caller ID is not possible on non jailbroken devices.
And I will give you some findings on how true caller works,
Its not reading the call history, they actually created Action
extension, wherever you try to share a contact, it will display
truecaller app extension, which coded for showing the contact
details fetched from their server
You might also get confused with push notification received for few
calls, saying
"Some X calls you". This is where truecaller used a trick. If you
noticed clearly, that push notification will be received only when
you get a call from an android user with truecaller installed. Let
me explain you in details,
X(android user with truecaller installed), calling Y(ios user with truecaller installed), the android version notify the server that X making call to Y. And server will send push notification to Y's iPhone.
Caller ID is not possible on non jailbroken devices.
However there is one way, in which you can know which user is calling, but not sure if it will be useful to you.
If you have a bluetooth device, connected to the iPhone, it will get all notifications, including incoming calls, which you can then get the caller ID for.
Apart from this, there is currently no other way at all to know the called ID.
I am looking for something similar to what is TrueCaller doing for android Don't know how it works in iOS, is it same way ?
Basically what is need is
A hook method to get call when call state changes.
And should be able to get the details in hook like phone number etc.
And make call to service with phone number for displaying name (unknown in case of no user found in our service) of who is calling in the screen.
Core Telephony does not allow you to retrieve any other information that the connection state.
So you CAN NOT get the phone number that is calling you, this has to do with privacy.
The CTCall Class only has two properties:
callID which is jus a unique id for this call, but not the phone number.
callState which is the state of the call, which is CTCallStateDialing, CTCallStateIncoming, CTCallStateConnected or CTCallStateDisconnected.
im still new with ChromeCast cast and still playing around with google cast ios examples. But when i disconnect the app with the google cast,the receiver still show the media that we cast. How to make its totally disconnected and show home screen?
Thanks!
What receiver are you using, is it your own custom receiver or the Deafult/Styled receiver? In the latter, we already take care of that if you are the last connected sender and explicitly disconnect yourself. In the former, you need to do that on the receiver yourself, look at the receiver documentation for onSenderDisconnected() call back.
The design checklist for "Sender stops cast" states
When the last or only sender is connected to a receiver, tapping Disconnect stops the app running on the receiver[...]
On iOS, GCKDeviceManager leaveApplication and stopApplication respectively leave the app or kill it but with no regards for other senders being connected or not.
How does a sender know it's the last one connected?
Edit: I'm not using the custom receiver
Right now you will need to have your own receiver (i.e. custom receiver) to do that and use the api that Angel had mentioned. In future, we plan to update the Styled Receiver to include that logic. In fact, right now, you cannot distinguish between an explicit or implicit disconnect, so if you want to implement the disconnection logic correctly, you have to use a custom receiver and use a custom namespace to send a message to the receiver when an explicit disconnect is attempted. Next release will address that issue as well.
You can do it within your receiver with castReceiverManager.getSenders().length