How to change sender mobile number in Android SMS service - android

I'm sending SMS in my Android App,
SmsManager sm = SmsManager.getDefault();
String number = "1234567890";
sm.sendTextMessage(number, null, "Test SMS Message--Successful", null, null);
It is working fine. My Question is, Is it possible to add string/text instead of Sender Mobile Number? so that in the recipient mobile, the sender's mobile number will be appeared as that string/text.

Yes, it is possible to change the sender phone number, but you need to use a third party SMS Gateway. You can reroute the SMS to come from a phone number that you register for your app.
Twilio - http://www.twilio.com/help/faq/sms/can-i-specify-the-phone-number-a-recipient-sees-when-getting-an-sms-from-my-twilio-app
TextMagic - http://www.textmagic.com/app/pages/en/products/bulk-sms-gateway-api

No. It is not possible. Here are multiple reasons why:
When you send an sms, using SmsManager you encode it with the content - the actual text message itself. You also encode it with the phone number you are sending it to. And you encode the message center number to the message. That is all you get to encode. Then Android/hardware handles sending it over to the cell phone tower where it is then out of your hands.
If you somehow tried to encode the recipient phone number as text, then the carrier would have no idea how to handle the message. It wouldn't have anywhere to send it too.
Cell phones do not have inbound Caller (or sms) ID - unless the number is already programmed, of course.
When the carrier network is sending an sms, it goes through a message center. The message center determines what data is forwarded to the recipient phone. The message centers currently available just do not support what you're wanting - at least not to the consumer.

Related

send and receive sms of specific number --android

I am work on a messaging system which is send and receive sms but the requirement is the application send sms to specific number which is store in its database and it also receive sms from specific number which is store in its database . actually the client is manufacturer of GPS system with GPRS in this system a sim card is stored which is reply when the sms is send it like current location and many function .when sms will receive which number is store in database of application the sms is not show in android phone default program which is already installed in device. tell me how can i start
You can use SmsManager to send sms.
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage("phoneNo", null, "sms message", null, null);
You can use BroadcastReceiver to receive sms.
Several tutorials are available online to understand BroadcastReceiver.

Sms received not the same sent

I am trying to develop an app that send and receive a sms
my sms's are too long so i used a multi partsend sms method
the sms is sent successfully bu when receiving the message the character are wrongly printed in screen
please help me
i tested it in a virtual device
SmsManager sms = SmsManager.getDefault();
ArrayList<String> parts = sms.divideMessage(keyAsString);
sms.sendMultipartTextMessage(getPhoneNo().getText().toString(), null, parts, null, null);
Have you checked the phone sending and the phone receiving are using the same character sets?
I'm not entirely sure how to check because I don't know what phone you're using but if the characters look something like this phenomenon then that might be your problem: http://en.wikipedia.org/wiki/Mojibake

Android SMS originating address issue

I have an app published that handles SMS messages. I have received some feedback about users wanting the app to handle SMS messages that come from a sender with letters instead of a plain old phone number. That is, if I understand it right, they sometimes receive messages not only from a sender number like "123-456-1234" but also from a sender like "LETTERED". I have never seen this before. In the emulator I tried emulating an SMS with such a sender using a command like sms send TESTSENDER MessageContent and the emulator says that it only accepts numbers +[0-9]*. Does any one else have any idea of what my users are talking about?
Your users are talking about companies that change their Sender ID to an alphanumeric number. Some examples of this are when your carrier texts you (i.e. my carrier texts me from 'Vodafone'), or when my dentist texts me about my upcoming appointment from 'DENTIST'.
Take a look at this answer for some info about how they do it: How do some SMS messages transmit the senders name?
If your app sorts texts or something similar, I imagine that you could just filter them the same way you would a standard telephone number.

How to get phone number of SMS recipient in Android

I have seen many questions asking how to get the SMS sender's phone number, but not the recipient's phone number. I have used the tool on this site to generate a PDU and can see the recipient's phone number in it:
Useful PDU details and PDU translation tool
However, I don't see anywhere in the SmsMessage class provided by Android where I can get the recipient's phone number. The reason I want to do this is that I have a Dual SIM phone, but don't see anywhere in Android where I can determine what SIM port is being used for the incoming SMS. At the very least, I want to look at each SMS message and determine what phone number they were sent to.
This question seems very similar to mine but with no answers:
How to get SMS recipient's phone number in Android
My question is different because I have detailed a link to a site about PDUs, which may be useful for extracting the phone number form the raw PDU bytes that the SmsMessage class provides.
Any ideas?
It depends from which point you watch SMS message.
SMS PDU lies on top of MAP protocol.
When you send SMS message, phone puts recipient number in TP-Destination within a PDU, when you receive SMS message, there is no recipient number anywhere. The reason for this is how SMS works.
When someone sends you SMS, GSM network on his side request SRIsm message for you, that means his HLR will try to find you either in his home network, or through your home HLR. The response from HLR is IMSI number (your SIMcard) and VLR/MSC number, to where sender network must send SMS.
In second packet, which is actually SMS message (Forward-MT), therefore is only your IMSI number.
Since you have dual SIM, you can try to find based on this number, to which SIM card is SMS destined.
Note that IMSI number is not part of the PDU but rather lower MAP protocol.

send sms message from Android app to a device

I've implemented code to send sms message from an Android emulator to another, which works well. But when I try to send message from the emulator or an Android device(with wifi only, no data plan or number with the phone) to a device(iPhone ), it doesn't work. I'm not quite sure if sms needs a data plan to send message in real world. Thx for the help!
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(number, null, message, null, null);
Though sms does not require a data plan, it needs a working GSM or CDMA Network connection with call working.
SMS is Short Message Service. It's been around longer than we've had internet on phones, and definitely requires a valid SIM card and a working network connection (data over network isn't necessary, but you should be able to make calls).

Categories

Resources