SmsManager not working in Android 4.4.x

2019-07-21 03:45发布

问题:

I am developing an Android app, which needs to send a message to multiple recipients.

I used this code to send an SMS to a phone:

SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage("9030500259", null, "sms message", null, null);

I have read many questions in this site which said the above is correct.

On Googling I found this:

http://android-developers.blogspot.in/2013/10/getting-your-sms-apps-ready-for-kitkat.html

According to the article in the above link, some changes happened in messaging.

I am unable to send SMS in my application. What is the correct code to send an SMS in Android version 4.4.x?

回答1:

i was facing same problem .but finally got solution . if u are testing this code in dual sim phone then sim slot 1 always keep active otherwise it " no service" error inn pendingsentintent.