Tall Jeff
Tall Jeff

Reputation: 9994

iPhone: How to Programmatically Respond to SMS Messages

After a review of the iPhone SDK documentation, I have not yet found a way for an application to be written such that it can programmatically process the content of an incoming SMS message within the iPhone platform. The idea would be for such an application to be running in the background and based on specifically formatted SMS messages would be able to take specific actions.

Does anybody know if this is possible with an iPhone SDK application and if so, provide a pointer to information about how this can be done?

Upvotes: 15

Views: 13136

Answers (5)

riven
riven

Reputation: 1526

You can use CoreTelephony framework.But you must user some private api.And I have some demo code for this. https://github.com/edison0951/AppNotifyBySMSDemo

Upvotes: 0

aldi
aldi

Reputation: 258

Unfortunately just registering an URL scheme dosn't help you at all, because the SMS app makes "http://" urls clickable only...

Upvotes: 0

Brad The App Guy
Brad The App Guy

Reputation: 16275

Unfortunately, you cannot intercept - or be notified of - incoming SMS messages with the iPhone SDK.

One possible alternative, is to register a custom URL scheme that launches your application when a url with that scheme is embedded in the sms message and the user cicks on it.

to set a custom url scheme, you must implement both the CFBundleURLSchemes and CFBundleURLName keys in your application's info.plist.

In your Application's delegate, you can then implement the application:handleOpenURL: method to get any paramaters that were passed to your App from the url in the SMS message.

Upvotes: 18

Genericrich
Genericrich

Reputation: 4651

BREW and J2ME had (and probably still have) ways to launch your app via specially formatted SMS, which may be what the Jeff is referring to.

Apple does have the upcoming Push Server which will allow you to send the user an alert which will give them the option of launching your app, but you cannot launch your app for them.

Upvotes: 1

frankodwyer
frankodwyer

Reputation: 14048

I believe that currently the SDK doesn't allow for background apps (except for apple ones).

Upvotes: 4

Related Questions