Search code examples
androidsmssmsmanager

Android Send SMS with App name


I wish to send SMS message with the App name as the source address. Meaning I will see the App name as the sender instead of my own number. This is my code:

SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phone, "App name", "Message", null, null);

I get the message, but the sender is my own number. How can I change the sender to be the App name?


Solution

  • hiding the sender native android is not possible, take a look at this post

    BUT.....

    Using a 3rd party service gateway (where price can apply)

    public class TwilioTest { 
     // Find your Account Sid and Token at twilio.com/user/account 
     public static final String ACCOUNT_SID = "AC......."; 
     public static final String AUTH_TOKEN = "98......."; 
    
     public static void main(String[]args) throws TwilioRestException { 
        TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN); 
    
         // Build the parameters 
         List<NameValuePair> params = new ArrayList<NameValuePair>(); 
         params.add(new BasicNameValuePair("To", "+0189899768798")); 
         params.add(new BasicNameValuePair("From", "SupeUSer GmbH")); 
         params.add(new BasicNameValuePair("Body", "this is the body")); 
         params.add(new BasicNameValuePair("MediaUrl", "ccccurlcccc"));  
    
         MessageFactory messageFactory = client.getAccount().getMessageFactory(); 
         Message message = messageFactory.create(params); 
         System.out.println(message.getSid()); 
     } 
    }