How do I Generate a Text Message to a Predefined Phone Number in iOS 10? - ios

Let's say I have the user of my app define a phone number in a setup step of my program, saved in the plist as a number with the key "PhoneNum". Now lets say that I want to have a button in the program which, when pressed, generates a text message that says "Hi! How are you today?" to the phone number saved under "PhoneNum". Is it possible to have this message auto-send without confirmation from the user? If so, can you point me in the right direction?

Yes, it's possible, if you pay for an SMS-sending service. Type “sms sending api” into your favorite search engine.
If you want to send a message through the user's own iMessages or cell phone account, then you cannot do it without confirmation. How to programmatically send SMS on the iPhone?

Related

Twilio SMS Webhooks and Group Text Messages

Is it possible to maintain both group text messages and single text messages with users and keep them separate? I understand there is no concept of a group message per se, but wanted to see if any recent advances in tech has made this possible with Twilio or other providers.
In short, I am creating a POC where a user inside an iOS App can send invoke an API call to my backend application. This application receives a phone number from someone's contact list, and then connects to Twilio to send the SMS message to that target user.
When the user replies, I was researching Twilio Web hooks to receive the message, and then save it in the database. The originating user, then, would be able to see the message on a screen.
I would guess that when a user responds to the twilio message, the only metadata that comes in is their message and phone number, so the "foreign key" is the phone number.. Thus when I save it in my database, I have their phone number and message.
This works up until someone decides to target two or more people in an SMS message using my API, and then target one of those people individually. For example they select me as a sole recipient, and then select me and someone else as a group text message.
In this case, how could my system/Twilio differentiate between if I was responding to the group message, or to the single message?
Any ideas or work arounds? Maybe another technology? Thanks!
I wanted to provide an answer to this in case anyone else was looking into this.
Essentially you pay 3 cents (0.03) per month per active user in each group. Basically you buy phone numbers for each group chat you need.
https://www.twilio.com/conversations/pricing
So if you're doing a million group chats obviously it can get costly, but for simple POCs this isn't the end of the world.
Enjoy!

Is it possible to send an SMS message from an iOS app to the current caller when a call is in progress?

I have searched and have not been able to find a definitive answer. I know that it is not possible to get the phone number of the current caller using Objective-C, but I don't need the number.
I want to send a text message to the current caller. Does iOS have a method to allow you to send a text message from an app to the current caller.
The scenario is this:
End user calls another user
They put the person they called on speaker phone and navigate to my app
The app has a button that allows them to share information via SMS to the person they are talking to while they are talking to them without having to do anything more than click a button (the user doesn't have to type the other person's phone number manually to send the SMS).
Sukhdeep is correct.iOS will never allow you to perform Messaging without user involvement.
The answer is No.
Apple will never allow you this.

IOS: How to verify user's phone number using codes

i am working on an app in which i take a field of mobile number of user after entering mobile number there is a option for verify phone number.
but i don't know the functionality of how to verify a user's phone number within the app using codes.I search for similar type of questions but didn't get the exact solutions.
i am sending a screenshot of my app where i want to put that functionality.
i didn't apply any codes for this
please help
You need a backend that can generate and save codes for each phone number and also send a text message with those codes. So the flow is as follows:
User enters their phone number in the app and presses the "Verify Number" button.
You send a request to your backend with the number provided. In the app, you also displays a text field for user to enter the generated code and a new button like "Check code".
The backend generates a new code (just a random one), stores it to the database (like ID,PhoneNumber,GeneratedCode,DateOfGeneration) and sends a text message with the code to the phone number specified.
When the user receives the message he or she enters the code to the checking input field and presses the "Check" button.
The mobile app sends another request to the backend with the phone number entered earlier and the code entered by the user now.
The backend looks to the database for the "Phone number" - "Code" pair and responds with failure (the code is incorrect, try again) or success (the phone is verified).
Unfortunately, there's no way to access text messages received by user from within an app on iOS devices (unlike Android). The proof link was already provided. So the user has to manually enter the verification code from the message.
Ok I tell the information how was I already did my project in before
Step-1
when user press the Verify Number button
initially I check the phone number is valid or not(means phone number count/length).
second I generate the random number on progrmatically like NSUInteger r = arc4random_uniform(16);
Step-2
send the random number to server along with the vaild phone number , the server send the random number to the particular mobile number using SMTP Server.
Step-3
in your hand you have the random number , so open the UIAlertview for user type the valid random number , if user typed the vaild number show the Next Screen else show the Alert.
To verify any mobile number you can use third party api's which are available for mobile as well as backend server. You can use Twilio Messaging Api. To use this API follow below steps:
Register account on Twilio and get key from account.
Get user's phone number from mobile application.
When user click on the "Verify Number" button, call web-service with the number.
When you'll call the web-service, write a logic to send the random number with the Twilio messaging api to send message to user.
When user get this number through SMS, You can tell user to enter the number and verify it.
Also, there is another api which you can directly integrate into your mobile application. You can find this Sinch Api here.
To verify against your device's phone number, first, you need to get the phone number from your device and then you can compare against. However, after iOS 4, getting phone number of your device is quite impossible. Even if, you do get the device's number using some private api which I am not sure works entirely, there is a huge possibility for Apple to reject your app.
Refer to the following stack overflow discussion-
Programmatically get own phone number in iOS
Just a suggestion: You probably want to look for a work around based on your business goal. For example, rather than checking for device's phone number directly. You can generate a code and send that to the number specified by the user and then enter that code to verify that the user has that device.

Making a faux iPhone dialer

I want to make a joke application for a friend (not for general sale) that looks exactly like the iOS Phone application but so that whatever number is dialled into the application it appears to dial that number but actually dials a preset number in the background.
The way I figured to do it would be through the following:
User enters a number and hits the call button
Save the number entered as a contact's name and programmatically set the number of that contact as the preset number
Get the application to ring the preset number, to which it would switch over to the real iOS phone application and dial, but with it being a saved number in the contacts it will display the name, which is the number entered by the user.
Delete that contact upon re-opening the application as for it to not ask which number to dial the next time.
This is the only way that I can think of pulling this off, but it seems like it will look unconvincing; especially when it switches over to the real Phone application. Can anyone think of a better way? Such as calling from within the application?
I wouldn't usually take junk requests like this but it made me curious as to pull it off best.Thanks
If you are not going to publish this, then there is no reason why you shouldn't use private apis. See this answer (How to directly make a phone call with private API CTCallDial()?)

SMS default contact name

Whenever I receive a text message from some services (namely Google and Blablacar), I see the service name as the sender (like if it was in my contacts) instead of an ugly phone number, as it appears when the text message comes from other services (Snapchat, Hello Bank).
I don't know if an app from the service needs to be installed on the iPhone for the service name to appear instead of the phone number : I have the BlaBlaCar app installed and (of course) one of the Google apps (Maps), but the sms from Google was to confirm my phone number as I created a google account my computer, not on my phone. So the text message cannot "come from" the iOS app.
When I click the sender "Contact" button and then the Info icon, I can see the real sender phone number (ex 4 66 45 3 for google and 2 52 25 22 27 for blablacar).
I have never added those phone numbers to my contacts myself, neither I see those "contacts" in my contacts.
I would like to know how it is made, so I can do the same when sending a text message from my server.
Are there some kind of pre-embedded default hidden contacts in iOS ?
Is there a field to fill in the app plist file like "default app phone number" that I didn't see ?
Is it some kind of a registration process with Apple so you can associate a phone number to a specific name ?
Thanks
Alright, I was looking in the wrong direction, this has nothing to do with iOS, Apple, or an iOS app setting, this is a feature of the Short Message System called Sender ID.
Here is a thread which lead me to the answer : http://developer.nokia.com/community/discussion/showthread.php/109878-How-to-Send-SMS-with-Sender-Name
This ability to set the sender ID is offered by many of the SMS sending platforms (Clickatell, SMSCountry, blastSMS...), but apparently it might not work in every country.
Here you can find some info about it : http://www.smscountry.com/custom-sender-id.aspx
Hope it will help if someone wonders like me "How hell Google has put itself into my contacts ?" !

Resources