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.
Related
I have an application that is using VoIP, PushKit, and CallKit, the client needs the reported incoming video call like WhatsApp video call notification.
The problem that I'm facing when PushKit receive a notification and my app doesn't report an incoming call to the CallKit the app will crash.
I tried to understand how WhatsApp did this trick, but no luck on the web.
Any advice or idea will be helpfull
Very simple - you should avoid situations where you receive a PushKit notification without reporting an incoming call.
Even if you don't want to report this call, you can report an incoming call with caller name "Connection failed..." or something like that.
I am developing an iOS messaging app that uses Twilio to send and receive SMS and MMS. The tutorial on Twilio about the iOS client seems to only cover outgoing and incoming calls. I understand that sending an SMS/MMS would mean that I send a HTTP request to my server, in which my server sends the request to Twilio in order to complete the sending. However, how would I receive messages on my app?
I know that Twilio numbers have web hooks that execute when the number receives this message, but how would I get this message to my app. I don't believe that there are delegate methods included like the voice ones. The only solution that I could think of right now would be to use push notifications from my server to the phone. Is there any other possible way? Thanks.
I was recently in a similar situation to yours, but my app only cares about receiving a response within a 2 minute window while the app is opened.
Regardless, I would say that your best options include 1) push notifications, 2) sockets (probably via Socket.io), or 3) background polling. If you plan to have your application receive the message agnostic of its state (open, closed, etc), then I would highly suggest using push notifications. I'm using Parse as my Twilio backend and it makes creating and working with push notifications a breeze :)
I am currently working on an iOS app that allows users to make calls and send messages to eachother, effectively it is WhatsApp with a few extras.
When one of the users is offline, I send an APNS to the other user that brings up a short notification. The notification that is shown works well for messages but when it comes to an incoming call, it would be nice if it stuck around on screen and the phone vibrated for an extended period.
From what I have read, you cannot alter the vibration pattern of an APNS. WhatsApp, however, has managed to do it and I was wondering if anybody had an idea of how they achieve this?
You should use VoIP Push Notifications (PushKit). These are special push notifications intended to be used for VoIP call notifications.
Some source to get started:
http://blog.biokoda.com/post/114315188985/ios-and-pushkit
http://pierremarcairoldi.com/ios-8-voip-notifications/
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 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?
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:
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.
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.
Yes, it is possible. But you would have to use a 3rd party service to send the text message. for example, Twilio.