I'm looking into using the Channel API to push messages to my iOS client. I haven't completely wrapped my head around it, but the only way would be to use a hidden UIWebView that triggers an Objective-C method.
Would this work? To have a hidden UIWebView listening to channel messages? How would the web view be notified of new messages by the channel? How would I trigger an Objective-C method when a new message is received, such as an alert saying "You've received a new message."?
Are there any downsides to this approach?
I'm doing the opposite. I'm using Urban Airship to send iOS notifications to my iOS app, which is really an iOS wrapper around a UIWebView.
GAE Channels aren't particularly robust in my experience, I've noticed messages not get sent, especially when you have to re-establish a connection. I wonder if the UIWebView connection will get disconnected when the app goes to the background.
I'm doing what you are asking. There are two things you need to be able to do: make calls from Objective-C into the UIWebView, and get events from the UIWebView to call back in to Objective-C. To do the first you call UIWebView's "stringByEvaluatingJavaScriptFromString" method. To call back into Objective-C, you register a web view delegate, and then in the "shouldStartLoadWithRequest" method you look for a "fake" protocol (e.g. "js-callback" or something like that) so that in your javascript you navigate an iframe to "js-callback:informationForObjectiveCToOperateOn". This blog post explains the procedure: http://blog.techno-barje.fr/post/2010/10/06/UIWebView-secrets-part3-How-to-properly-call-ObjectiveC-from-Javascript/.
Related
I was asked to create functionality to iOS app which will sent SMS or dial number if worker doesn't push button after some time period in app. App work completely without internet connection (in deep forest, badly covered area without internet connection or something like this). But I was searching possibilities whole day but nothing.
So, is there some solution how to do this or it is impossible?
In short IMPOSSIBLE in IOS; without voip (mean no internet).
IOS does not allow to override default Dial UI methods. or any changes.
So these functionalities cannot be implemented.
You can use your separate application, but VOIP for calling and some api for messaging.
I'm looking for the class that handles call duration UIView ( Or caller name ) for iOS 8
, So i could hook into it and find its frame position
What i tried and found so far :
I looked up the TelephonyUI private framework headers classes and Found nothing after so many hours of digging and trying
Sounds to me that it's related to MobilePhone.app but couldn't also find anything
syslog mostly logs data from it under Core Telephony Framework
On iOS 8 the in call UI no longers runs in MobilePhone or SpringBoard. It actually runs in a separate process - InCallService.app. It's works just like MFMessageComposeViewController I researched here. MobilePhone or SpringBoard (don't know for sure and it doesn't really matter), displays, what is called, remote view controller for in call view - it's a view controller which is being displayed in your app but the actual logic behind it runs in a separate process.
For example, when you display MFMessageComposeViewController to send SMS message from your app you actualy using proxy object which connects through XPC to another process where actual view controller code runs. Your app only sends user input to the process and displays results that it returns to you - remote view controller forwards method calls through XPC connection. You don't actually have any control over the controller - you can manipulate it through a very limited API provided by XPC service that implements the logic.
Obvious purpose of these remote view controllers is security. On iOS 5 there wasn't any and MFMessageComposeViewController was implemented just like a regular view controller. It meant that you could reverse engineer it to send SMS messages without user permission. And that exactly what some people did - there was AppStore apps that could send SMS messages silently using this code. Starting at iOS 6 that code requires special entitlement that AppStore can't have. MessagesViewService.app has it and through remote view controller running in it you can send SMS messages from AppStore apps but now you can't do it without the UI and user interaction.
Same with in call UI. You can test it by doing a call and then killing InCallService.app process - in call view will disappear. So in order to change something you need to hook InCallService.app. Unfortunatelly I didn't research it to tell you exactly which methods you need to hook but at this point it will be very easy. I suggest you start looking at PHInCallRootViewController, PHInCallRootViewControllerActual and PHCallParticipantsView. The latter has a very interesting method setSingleDurationTimerLabel:(id) which modifies _singleDurationTimerLabel ivar. It looks like duration label view.
Can we get incoming call information(number) programmatically in iOS7?
I want to create an application so that at the time of any incoming call, my application cuts the call and sends a text message to that number.
Read this may be helpfull, Because in this user blocking calls according to number. where you can check your number How can I use private APIs to block incoming calls in an iOS application?
In this user getting info of incoming calls
There is a hack for this but you can't publish to the AppStore with it.
You can only use this in ad-hoc applications.
What exactly I need is that when an incoming call come and my app is in foreground than the call must be automatically received and loudspeaker must be activated.
I have seen many post in SO saying that to intercept the calls is not possible in iOS.
But what if I use any VoIP API and make calls from it to my app[app to app call] ?
can I receive the call automatically in that case or that time also the SDK won't allow me to do so as its the core part of iOS I am too much confused.
This is not possible with UIKit, and furthermore if you did use private Apis your app would not be approved.
How does Truecaller intercept incoming phonecalls on the iphone to display caller ID?
I didn't think this was possible from within the app?
Specifically, if I wanted to build this functionality, what protocols would I go about using?
http://www.truecaller.com/how-it-works
On an iPhone, without jailbreaking it:
- you cannot intercept a call in any way
- you cannot determine the phone number nor the caller ID identifying information regarding the call. Even if you could there
is no way to alter what is displayed on the call screen
- you cannot block the call
- your program can get a notification when a call is being made/terminated etc. But only if your app is executing in the
foreground at the time of the call or if the app is in the
background and has a relevant background mode (even then you can
only know there is a call in some circumstance, depending upon what
you're doing in the background and what state your in etc. Its too complex to describe the exact situation here briefly)
True Caller doesn't do that on iOS as it isn't supported with the native SDK. See their FAQ:
http://www.truecaller.com/support , specifically the "Why don't I receive live caller ID?" Section under "iPhone/Windows Phone". If you must though, try looking into a solution for jailbroken devices.
It's impossible to "intercept" calls. It is possible to handle the "background event call" when a iPhone get's a call. That said, Truecaller doesn't intercept calls. More info can be found on their website.