How to change sender mobile number in Android SMS service

别说谁变了你拦得住时间么 提交于 2020-02-14 02:26:31

问题


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.


回答1:


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.



回答2:


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



来源:https://stackoverflow.com/questions/8589306/how-to-change-sender-mobile-number-in-android-sms-service

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!