SmsManager has a method that is sending SMS message completely without user’s interaction needed. If You need to send SMS from your code:
1. Use SmsManager
Add these lines to your app
import android.telephony.SmsManager; SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage("123456789", null, "sms message", null, null);
You can replace these nulls with Intents (according to documentation) that will be fired up when SMS is delivered / sent / failed to send. In basic case it is optional and can be null.
2. request permissions in AndroidManifest.xml
Add these lines to Manifest:
<uses-permission android:name="android.permission.SEND_SMS" />
Remember to have active SIM card in your device when you want to send SMS :)
Did I help you?
I manage this blog and share my knowledge for free sacrificing my time. If you appreciate it and find this information helpful, please consider making a donation in order to keep this page alive and improve quality