Rohan Mishra
Rohan Mishra

Reputation: 213

How do I send an SMS on iOS without having to get the user to ok it?

How can I send a text message (natively or through the use of an API) from an iOS application to someone without having them have to interact with the message before hand?

The message would be prewritten and would send on tap of screen. Its ok if the user needs to okay it once, but I need a way to send a message without having to have the user interact with their device each time.

Example: Phone is off, I shake phone, phone senses shake, sends text messaging saying "I'm shaking" to another user via SMS or MMS without having the user need to OK the sending. Is this possible? How would I do it?

Upvotes: 0

Views: 176

Answers (3)

scord
scord

Reputation: 1395

Yes, it is possible. But you would have to use a 3rd party service to send the text message. for example, Twilio.

Upvotes: 0

Christian
Christian

Reputation: 22343

You can't do that. You need to show the user the message in the MFMessageComposeViewController that pops up first, and he has to send it by himself.

This restriction was made, because otherwise, many apps could spam your contacts etc. with a massive amount of sms or they could even write sms to expensive numbers.

But if you want to send just some kind of notification to another user, you could use push notifications. To do that, I would recommend you to use parse.com and their free push notification-service. Also, because Push Notifications are free, in contrast to SMS, you will save a lot of money. Of course you need to make some preparations before you can send notifications, but that way you could do it. But also there are restrictions. One restriction is, that the receiver of the notification also must have the app installed on the receiving device.

So the receiver would receive a "message" like that:

enter image description here

So I would recommend you to check the QuickStart Guide from Parse.com for iOS for further informations. The Guide is really simple and shows you step by step how to activate your app for Push notifications.

Upvotes: 1

Toastor
Toastor

Reputation: 8990

Sorry, but you can't, it is completely impossible. The only way to send sms is through messageUI, which always requires the users consent. You can probably do it on a jailbroken phone, though.

Upvotes: 1

Related Questions