htafoya
htafoya

Reputation: 19273

Send SMS programmatically, without the SMS composer window

Until yesterday I thought that it was not possible to send background SMS without using the IOS SMS interface (Which many people here assure also). However, today I downloaded a new app called SmartSender, which schedules your SMS and then sends it automatically.

I tested it and the SMS is not actually sent on background, but a local notification appears and when you click on it to bring app to foreground, the SMS is sent automatically.

How could this be achieved?

Maybe Apple approved the app because the interface is very clear on what you are doing and what you are sending, but how can you send SMS without showing the interface?


Update: The scheduled SMS appear on my phone Messages app as sent, so I don't think that they are using another service to send SMS, also the receiver phone is indicated that the SMS was sent from my phone.


Update 2: OK I'm using and watching the app doing this, so IT IS POSSIBLE without showing the default interface, I'm not asking whether this can be done or not. I am using it with all internet connections turned OFF, and the message is sent from MY PHONE so it appears on the MESSAGES APP. So the app is not using any third party service.


Update 3: I will accept my own answer, in fact it is not possible; however it was when the question was answered. The App in question has now specified in its description that it won't work in iOS 6, so I think Apple patched some bug that could be exploited to achieve this functionality.

Upvotes: 15

Views: 26228

Answers (6)

Manish Agrawal
Manish Agrawal

Reputation: 11026

You can not send SMS programmatically in background, you can use following third party API to send the text message (SMS).

  1. http://www.twilio.com/
  2. http://www.nexmo.com/
  3. https://www.tropo.com/

I would suggest nexmo, its easy to use and support international messages also.

Upvotes: 4

elp
elp

Reputation: 8131

You can use:

[[UIApplication sharedApplication] openURL: @"sms:+3912345678"];

it doesn't work on simulator... and you cannot send programmatically sms!

Tested on iOS < 6.

Upvotes: 2

htafoya
htafoya

Reputation: 19273

In fact it is not possible; however it was when the question was answered.

The App in question has now specified in its description that it won't work under IOS 6, so I think apple patched some bug that could be exploited to achieve this functionality.

Upvotes: 3

Mathieu Dugr&#233;
Mathieu Dugr&#233;

Reputation: 61

I've been looking into the SMS send/receive limitation on iOS for a few days, using iOS 6 and XCode 4.5 (latest as of writing). I was curious about this SmartSender application so I purchased it.

I don't know if it's because I only tried it on iOS 6, but I get the standard message controller (MFMessageComposeViewController) to send messages. I have tried delayed send - I get the message controller at prescribed time and have to manually click on Send. I have tried immediate send - that pops up the controller and I also have to manually click on Send. If I click on Cancel, the app actually loops me back into the message controller (I can't cancel unless I kill the app!)

So true, this allows entering messages from a custom UI, but then the message itself is copied into the MFMessageComposeViewController and that is what sends the SMS. So App Store approved, but nothing like what we're all looking for!

Upvotes: 5

yuji
yuji

Reputation: 16725

Having tried the app, I can verify that it does send SMS programmatically, without showing the SMS interface. And it clearly doesn't happen through a third-party service, since the message gets sent as an iMessage when possible.

It's also clear from all the other answers that there aren't any public APIs for sending SMS programmatically, so the developer must have used a private API and yet somehow snuck this app through the approval process.

Specifically, it seems he used the CoreTelephony API. This post on SO describes the procedure. Apparently you'll also need to get your hands on the CoreTelephony header files somewhere.

Upvotes: 7

Sonny Saluja
Sonny Saluja

Reputation: 7287

There is no way to send SMS programmatically. You may want to investigate a 3rd party service service for sending SMS like Twilio.

Upvotes: 0

Related Questions