ios: How to send SMS in background - ios

I know How to use MFMessageComposeViewController to compose message and forward the SMS and I want to send SMS in background without displaying message composer view. so If I click on button SMS will send in background without prompting to user.
There are 3rd party API's like Twilio, nexmo and tropo but i am not getting how to implement with those API's.
There is any other way to send SMS in background?

Using the standard API's you can only send an SMS with user interaction.

You can't send SMS or e-mail without user interaction unless there is any server interaction. If you really want to send SMS in background, send the content and reciepients to your server in background and from the server side you can send SMS to your receipients.

Related

How to send SMS from Chat flow in Studio

I have a studio flow that receives chat messages (from Whatsapp) and forward the conversation to Flex.
I'm trying to send a SMS notification to a hard-coded number as this happen.
The issue is that the SMS is never sent and the Send Message widget fails with the following log:
Failure sending message: Chat service or channel parameter missing
I understand that it's probably because the flow has a Chat context and that the widget expects a Chat Service. But I want to send a SMS.
I tried to configure the Send Message widget like this:
SEND MESSAGE FROM and SEND MESSAGE TO set and all other config fields empty
SEND MESSAGE FROM and SEND MESSAGE TO and PROGRAMMABLE CHAT SERVICE with a Messaging Service ID (which doesn't really make sense but hey...)
Neither worked.
How can I send a SMS from a Chat flow in Studio?
I was just able to knock up a quick Studio Flow that receives messages from WhatsApp and sends out an SMS to a hard-coded number and it worked for me. The way I did it was to hard code both the Send message from and Send message to numbers in the Messaging & chat config section of the Send Message widget, like this:
In this case you must ensure that the Send message from number is a Twilio number that is able to send SMS messages.

Is it possible to receive SMS notification inside an app in IOS?

Consider 2 iOS phones running an app.
The app in one phone sends a SMS to the other phone. I want to know two things.
Is it possible to show a notification inside the same app in second phone when this SMS is received.
Is it possible to receive this SMS only inside the app ie, this SMS should not go to the default iOS message inbox.
No, it's absolutely not possible without jailbreak.
iOS does not provide any public API to deal with SMS without going through the MFMessageComposeViewController.

How to send and receive text messages without MFMessageComposeViewController?

I want to send and receive text messages without showing MFMessageViewController from my application. Could anybody tell me how is it possible?
Not Possible , Unless you use 3rd party api for send/received sms.
you have to use Web service and Apple Push Notification Service for send message to other user without using MFMessageComposeViewController
You can't do it without MFMessageComposeViewController. Apple won't allow to send SMS without user interaction.
I've alternate solution of this, out of scope of iOS. Use web service API. Create a web service at server side that send a message to specific number(s) that accept numbers as parameters with request.
At specific time interval (according to your requirement) send a web service call with number as request parameter.
Web server can do it. It can send message to any device.

Send background SMS without interaction

I want to send a background SMS in iOS 7, and i dont want user to have to interact with any front end view. How can i do this ?
I will use this application for myself (no app store), so private api allowed .
With MFMessageComposerViewController it is not possible to send without user interaction. You have to take SMS gateway and implement your own way of sending SMS, than only it is possible. Like you have to create webservice and accept parameters from iPhone like phonenumber and message and than send SMS using SMS gateway.
Hope this helps.

How to handling incoming sms when app is active

I'm developing an iOS app that sends sms. What's the best way to handle a incoming message when the app is active. Is this done automatically or do I have to code for this in my app via the
applicationWillResignActive:(UIApplication *)application
method?
You don't need to/shouldn't need to deal with incoming SMSs.
When the device receives an SMS (or an iMessage these days), then the user will be notified by their method of choice. They may leave your application via that notification, but you cannot determine that it was the SMS that caused it.
CoreTelephony provides some abilities for people to deal with Calls, but nothing to do with SMS. Sorry. As such your app cannot determine the state of SMS messages. You're able to send SMS messages because the OS provides you with a view controller to do so, but you can't do anything else with them.

Resources