Sending SMS Messages in Android

Damith's Blog

This is a simple example can be used to send SMS in android devices. In here i have created two emulators and i will send sms from one emulator to another. I have not tested the code in a real device and i am sure it will work without any errors. This example extracted from the

Java code looks like below

/* * Source : * * */ package com.sms; import; import; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.telephony.SmsManager; import android.view.View; import android.widget.Button; import android.widget.Toast; public class Main extends Activity { private Button btnSend; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); btnSend = (Button)findViewById(; btnSend.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { sendSMS("5556", "test"); } }); } /** * This method can be used to send SMS from android * @param phoneNumber…

View original post 190 more words


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s