I'm trying to send SMS without user interface with SMSManager . thats ok on android 4.1.2 and below but it's not working in Android 4.4.2.
This is my code :
SmsManager sms = SmsManager.getDefault();
ArrayList<String> msgStringArray = sms.divideMessage(message);
sms.sendMultipartTextMessage(phoneNumber, null, msgStringArray, null,null);
What is wrong ?
It's possible that your app cannot send an SMS because of changes in Android 4.4. Outlined at https://developer.android.com/about/versions/android-4.4.html#SMS you can see the changes.
SMS Provider The Telephony content provider (the "SMS Provider") allows apps to read and write SMS and MMS messages on the device. It includes tables for SMS and MMS messages received, drafted, sent, pending, and more.
Beginning with Android 4.4, the system settings allow users to select a "default SMS app." Once selected, only the default SMS app is able to write to the SMS Provider and only the default SMS app receives the SMS_DELIVER_ACTION broadcast when the user receives an SMS or the WAP_PUSH_DELIVER_ACTION broadcast when the user receives an MMS. The default SMS app is responsible for writing details to the SMS Provider when it receives or sends a new message.
Other apps that are not selected as the default SMS app can only read the SMS Provider, but may also be notified when a new SMS arrives by listening for the SMS_RECEIVED_ACTION broadcast, which is a non-abortable broadcast that may be delivered to multiple apps. This broadcast is intended for apps that---while not selected as the default SMS app---need to read special incoming messages such as to perform phone number verification.
For more information, read the blog post, Getting Your SMS Apps Ready for KitKat.