Wednesday, June 13, 2012

Sending an SMS


Sending an SMS from your app is actually quite simple.  Note that once you add sms capabilities to your app, devices (like tablets) that don't have SMS can't install the app.



 String message= "Watson come here"; 

 String watsonsCell= "1234567890"; 

 SmsManager sms = SmsManager.getDefault();  

  if (message!=null) { 

   sms.sendTextMessage(watsonsCell, null, message, null, null); 

 }  



You need to add a permission to the AndroidManifest.



 <uses-permission android:name="android.permission.SEND_SMS"/>  



If you want to process an sms, you need the following permission, but it isn't necessary for sending.



 <uses-permission android:name="android.permission.RECEIVE_SMS"/>