How would I get SMS/Phone events, and act on them before they're sent to the system apps? - iphone

I'm trying to develop an application for a jailbroken iPhone similar to Mcleaner or iBlacklist.
What I want my app to be able to do is intercept SMS or Phone events and handle them before they're sent to the appropriate receiver. So for example, I want the application to get an SMS event, compare the sender to an array of numbers, and either process the data or ignore it and pass it off to the SMS app.
In MCleaner, you can define a blacklist of numbers, and if a text message is received that matches the blacklist the user won't get an alert from the phone and the data is instead handled by MCleaner.
How would I go about getting these events, and further, how would I get these before the appropriate apps receive them? From what I understand, I'd need to become a first responder for these things, but I really have no clue where to start. I can't seem to find any hints on how I'd go about this as this app will not be calling apple classes to get the data..
Thanks.

I can only guide in with this, sorry, the code isn't mine to give.
In memory, all the action calls are all just pointers. What you have to do is over ride the pointer to make it point to your own function. Once you do that, you do w/e you want in your function, and then call the default function call. This ensures the integrity of the action calls and allows you to intercept the actions.

You need to use the CKMessage class.
Check this out: http://hexorcist.com/private_frameworks/html/interface_c_k_message.html
and this: http://www.ifans.com/forums/showthread.php?t=232745

Related

how to add progress message in google home dialogflow

In my conversation dialogflow, I would like to add some progress messages like hang in with me, I'm looking up for that data or similar in the conversation. Is there any guidance or best practice to do this?
Unfortunately, there is no good way to do this at this time. If your webhook takes longer than about 5 seconds, Dialogflow will return one of the default responses it is set with. If you're not using Dialogflow, the Action SDK will say your webhook isn't responding and will close the conversation.
There is currently no way to send a reply, and then send another reply without the user saying something first.
One workaround might be to have the default response be something like "I'm looking that information up. Ask me again in a few seconds." When your lookup finally completes, cache the information so when/if the user asks the question again, you can return it more quickly.
Depending how long it takes, you may also wish to register a dynamic reprompt. This will send an event to your webhook if the user doesn't say anything. In a situation like this, they may say nothing for a few seconds, but that may be long enough for you to have computed the reply. So after a few seconds of silence you can suddenly announce "I've figured it out, the answer you were looking for is..." or something similar. This has some limitations - you can only reprompt twice like this before Google sends you a final reprompt and closes the conversation.
Although the platform does support notifications, these are still in developer preview and don't work with all devices. They also don't quite continue the conversation (it doesn't just start talking) - they just send a notification to a phone that there is a message and that they can restart the conversation. Depending on your use case, this may be useful combined with the above.
Update
The Media Response includes a feature that we can take advantage of to handle this. Similar to the dynamic reprompt method above, you'll get a call automatically when the media you're playing ends. So you can play a short "hold music" and your webhook will be called when it is finished. You can then either give the result or say you're still working on it and play more hold music.

"Do Not Disturb" feature in iOS 6 How to implement?

I want to implement the feature "DO Not Disturb" in iOS 6.
First question : Is there any framework or api apple exposed to control them through the code?
After lot of googling i found an application on the app store "Call Bliss" that provides this functionality and complete control over the calls, sms and mms.
Can anybody explain how this application works?
or
any other work around to learn and implement this feature in iOS?
Thanks in advance...
From reading the description of Call Bliss, it actually sounds quite simple in how it works.
1) Do Not Disturb must be enabled at all times. Not scheduled, not off, but on at all times.
2) It requires you to set the contacts group for exceptions to Do Not Disturb to "Bliss Exceptions". This implies that the application requires access to your address book.
From there, it's probably wise to assume that it manages the contacts in the "Bliss Exceptions" contact group based on whatever parameters you set in the application. It adds and removes people in that group based said parameters.
So to answer your question, no, there is no framework to do this. The way they're doing it is likely the only way to do it currently with no public API for managing do not disturb status.
There is no public API to even access do-not-disturb functionality.
I think this is what the app does:
The app creates and manages its own contact list (called Bliss exceptions)
the user have to select it in the do-not-disturb preferences.
The App can run in the background because it uses location tracking (probably significant only to save battery life), so when the user changes locations it can update the exception list.
When a call is received do-not-disturb system functionality checks the Bliss exceptions list and silences all calls from contacts on the list.
Please note that reviewers complain about the lack of time based call blocking. It is impossible because the app can only execute code when the location is changed.
In my Knowledge there is no way to implement it via code. There is no public api provided for restricting the calls.
But there is an API for detecting the calls : CTCallCenter and a FrameWork called CoreTelephonyFramework

Handling Invitations for Programmatic Turn-Based Game

Thanks to the updates to GameKit API in iOS 6, I am finally able to implement my turn-based board game the way it should be, complete with turn timeouts and better programmatic creation of matches. However, I am running into an issue that I cannot seem to solve. My desire is to have Game Center running entirely invisible to the end-user, so that everything is programmatic and uses my own custom interfaces.
Therefore, I use my own custom table view to display matches, not the default GKTurnBasedMatchmakerViewController. Right now, I have no problem displaying open matches using the -loadMatchesWithCompletionHandler: method. I also use a custom screen to create a match, with a direct creation for auto-match (not a problem) and a table view that loads Game Center friends of the localPlayer for invitation. Since the playersToInvite attribute can now be filled with playerID's, this is possible in iOS 6.
My main problem is handling the invitation on the recipient's side. Lets say I invite Bob to play my game in a two-player match. Right now I can't seem to find a notification for a new invite on Bob's end. The -handleTurnEvent: only gets called for existing matches or if the banner notification is touched (which I can't guarantee the user will do), and -handleInviteFromGameCenter: does nothing for me in this case.
The only way I have come up with to detect new invites and thus update my custom game view controller is to call the -loadMatchesWithCompletionHandler: method and check for new matches in which lastTurnDate of the invited participant is nil and against an existing array of open matches. I run this check about every 10 seconds in the background since I can't find a notification in GKTurnBasedEventHandler that is called when a new invite is received. Please help!
EDIT: In the end, I have just implemented a pull-to-refresh functionality. There is no way without implementing polling or some other method that would just waste the user's data on their phone, so on demand refreshing is the most ideal solution in my opinion.
Please see this : GKInvite Reference and more specifically inviteHandler.
You just need to register an inviteHandler which will be called after Bob accepts the invite in GK/GC.
T.

Asynchronous Calls (specifically iOS geocoding)

I'm wondering how to deal with this particular issue:
I'm creating a place object, which gets initialized with a geographical lat-long pair. Then I use the iOS geocoder to get an address for that coordinate. I want to set that address to one of my instance variables. However, this asynchronous call doesn't get completed in time, so when I instantiate my object and try to display the address, it hasn't been done yet. What are some strategies to deal with this and similar problems?
Thanks! Merry Christmas!
I don't feel like creating an extensive answer on Christmas Eve so I'll give a brief answer here for now, and edit it later if you've got questions and/or want more details.
Asynchronous requests all have delegate/protocol methods that let you know when the request has failed or succeeded. You should use the NSNotification API and register any object that needs the address for a notification that's triggered when the object completes the request. When the object receives the notification, it can then configure its views or whatever it needs to do. In the requestDidFinish (or whatever) method, you should send the notification.
Check out this article for details (as well as some cool stuff about threading!): http://www.raywenderlich.com/4295/multithreading-and-grand-central-dispatch-on-ios-for-beginners-tutorial

Checking incoming call in iphone

I have read about the CoreTelephony class and in this CTClass can check caller and find state of call....
But when and how to use this......
I think my application goes to background when call start..
help please or correct me......
It is not possible with the official SDK. The best that you can do is determine if the user is on a call. You can do this by inspecting the size of the status bar frame.
[UIApplication sharedApplication].statusBarFrame
If your asking if you can track phone calls in the background, you can't in all situations.
If you want to know if, at any point in time, when your running, you can. You can access the 'CTCallCenter' currentCalls property and it will give you the state of the call at that point in time.
If you want to track if a incomming call the cause of your application going to the background, you can use the 'CTCallCenter' callEventHandler property.
Not quite sure what you're trying to accomplish but after the call ends the user should automatically be brought back to the app.
It's not possible to get this information with the current SDK, most likely for privacy reasons. I'd recommend filing a feature request with Apple (http://radar.apple.com) however, I doubt it's something they're likely to include in the future.