I have a bulk sms site http://esmsafrica.com now I am building a sms app that will use the same API so that users registered on the site can still view there balance and send sms, I understand to use default smsmanager for android is below code, I have also searched on android developer page yet nothing seems to help, can someone let me know how to go about this, would I need to import any code from my site? I believe it should look like below code. I have a valid API code, username and password.
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, senderID, message, sentPI, deliveredPI);
Related
I am making an Android App that takes food orders from customers for home delivery.
When the order is confirmed, I want the App to send an SMS to the Customer and the Hotel about the Order summary.
I am new to Android so pardon me for asking newb questions.
I tried Android's SMSManager to send the SMS.
public void sendthisSMS(String phoneNo, String msg) {
try {
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNo, null, msg, null, null);
Toast.makeText(getApplicationContext(), "Message Sent",
Toast.LENGTH_LONG).show();
} catch (Exception ex) {
Toast.makeText(getApplicationContext(),ex.getMessage().toString(),
Toast.LENGTH_LONG).show();
ex.printStackTrace();
}
}
This works great. But The problem is,Using this code, the SMS amount(0.5 Rs) is getting debited from the customer's Phone.
The App should send the SMS for free.I'm using a server for storing data of the App and its users.
How to implement this SMS thing on the server end so that The server bears the SMS fee and not the User using the App. ?
You are executing this method from your customer's phone. It is indeed logical to think that the balance gets reduced from the customer's phone. If you do not want to send the SMS from their phone, you have to use a SMS Gateway, such as this one. You have to pay for each SMS sent through this gateway.
So the net result is either you pay or your customer pays. If you are from a startup and want to minimize costs, I'd suggest you to include a disclaimer above your Order Now button stating that an SMS would be sent, and the customer will be charged for that.
The other option is to send an email to the 10 digit mobile number using this list, as #EliSadoff said in the comments.
I am developing an android application. It requires to send text message (i.e.SMS) for OTP(One Time Password) purpose to user so he/she can enter the valid OTP code and get logged in to application.
I was looking at SMSManager API provided by android framework which uses to send text messages from application itself. But I need to send a text message from my registered number to user.
How can we achieve this requirement?
If you want to send sms via your application this is the way.
SmsManager.getDefault() - get default instance of SmsManager
sendTextMessage(String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent)
Use this to send the SMS
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNo, null, sms, null, null);
don't forget
<uses-permission android:name="android.permission.SEND_SMS" />
check this link for more info if required
Is there a way to programmatically send sms messages without them showing in the Messaging app?
I am using the following code to send SMS:
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage("number", null, "message", null, null);
And the messages are showing in the default Messaging app aswell as Google Hangouts. For my application it would be ideal for the messages not to show up, as they are simply sending code to a GSM module, and they just fill up the users Messaging app.
If you aren't sending real texts, you should probably send a port based SMS which won't be added to the messaging DB. But if you can't, you need to delete it from the sms content resolver.
ctx.getContentResolver().delete(Uri.parse("content://sms/inbox"), {"body"}, messageBodyToDelete);
In my application I am trying to send a text message with the following code and it's working fine. But when I check the native messaging application the message that i have sent from my application is not in the native messaging application. Am I missing something or is their any other code that I have to write, so that the text that I'll send from the application also get's updated in the native messaging application. The code that I am using is:
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(number, null, message, null, null);
Please let me know how can I create an entry in the native messaging application of this message.
Thanks..
The stock Android text messaging app allows you to send SMS to an email account instead of a phone number. How is this done? I tried the following code and it failed.
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage("myaccount#gmail.com", null, textMsg, sentPI, null);
This other question seems to be related How to send SMS message reply to email address?
... but the accepted answer says
Each cell carrier has a specific SMS number that you can send a text message to in a certain format. This is called a "SMS Gateway".
I want to send to my gmail account, not to AT&T.
Sorry, seems I misread the answer. Looks like my carrier (AT&T) will send the email for me. What puzzles me is how an app could work for different carriers?