Try the below code and then call, sendSMS("99999999999", "message");
to send sms in desired number.
//---sends an SMS message to another device---
@SuppressWarnings("deprecation")
private void sendSMS(String phoneNumber, String message)
{
Log.v("phoneNumber",phoneNumber);
Log.v("MEssage",message);
PendingIntent pi = PendingIntent.getActivity(this, 0,
new Intent(this, **DummyClasshere.class**), 0);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, pi, null);
}
Please place the following permission into AndroidManifest.xml
file.
<uses-permission android:name="android.permission.SEND_SMS"/>
Hope this might help.
Update From the comment: DummyClasshere.class is an activity without doing any process or the class in which u need to navigate.
You can use Object.class in place of DummyClasshere.class.