I'm developing an Android app that sends SMS to customers, I'm using a Sony XPERIA T2 Ultra Dual with Android 5.1.1.
This is my code:
SmsManager smsManager
= SmsManager
.getSmsManagerForSubscriptionId(subscriptionId);
smsManager.sendTextMessage( sms.getNumber(), null,
sms.getContent(), sentPI, deliveredPI);
The messages are located in Messages App, but they're marked as unsent. I' ve been trying to add message center number as scAddress param, but It doesn't work. I tested all solutions in stackoverflow but nothing works. Anyone has an idea?
Thanks!
Finally I found the solution.
My app manifest was this:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.RECEIVE_SMS" />
But it also has to have this:
<uses-permission-sdk-23 android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission-sdk-23 android:name="android.permission.RECEIVE_SMS"/>
<uses-permission-sdk-23 android:name="android.permission.SEND_SMS"/>
<uses-permission-sdk-23 android:name="android.permission.INTERNET" />
<uses-permission-sdk-23 android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>