Can I send SMS using no default SMS app on Android 4.4 Kitkat?
It means, Can I send SMS without ability to write to SMS Provider?
I confused about that on Android 4.4 Kitkat.
I wonder I can just send SMS using non default SMS app or not.
Can I send SMS using no default SMS app on Android 4.4 Kitkat?
It means, Can I send SMS without ability to write to SMS Provider?
I confused about that on Android 4.4 Kitkat.
I wonder I can just send SMS using non default SMS app or not.
You can send SMS even if your app isn't the default SMS app.
However, you won't be able to use the SMS provider.
That's the whole point of the new version - to make it clear to the user which app is allowed to use special SMS operations and have only one default app for this.
look at this text (taken from android developer blog) :
In consideration of some apps that do not want to behave as the default SMS app but still want to send messages, any app that has the SEND_SMS permission is still able to send SMS messages using SmsManager. If and only if an app is not selected as the default SMS app on Android 4.4, the system automatically writes the sent SMS messages to the SMS Provider (the default SMS app is always responsible for writing its sent messages to the SMS Provider).
so, in short, if all you need is to send and receive SMS, you can still do it.
however, some operations require that you will have your app as the default SMS app.
You can try this code:
PendingIntent sentPI = PendingIntent.getBroadcast(context, 0, new Intent(SENT), 0);
PendingIntent deliveredPI = PendingIntent.getBroadcast(context, 0, new Intent(DELIVERED), 0);
android.telephony.SmsManager.getDefault().sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI);
And in Manifest:
<uses-permission android:name="android.permission.SEND_SMS" />
It don't need confirmation from user if sending number don't 4,5,6 - digits.
© 2022 - 2024 — McMap. All rights reserved.