What is the procedure to detect if an Android device has SMS send capability? I want my app to know if the device has the capability to send an SMS message before trying to actually trying to send it. Thanks.
1 Answer
if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
// THIS PHONE HAS SMS FUNCTIONALITY
} else {
// NO SMS HERE :(
}
That should work for API Level 5 and above.
-
5FYI, by default this returns false in the AVD emulator, even though the emulator allows you to send in SMS messages over telnet: 1) telnet localhost 5554, 2) sms send <phonesender> <text message>– Dan JJun 1, 2011 at 20:50
-
2This will probably also fail for any non-telephone-capable device (like a tablet) that has Google Voice installed. Jun 6, 2012 at 17:09
-
1@rnstewart second that: if sending sms via Google Voice, Skype or any other internet service is possible, this method will fail. This method only checks if you can send sms directly via telephony network. Note that if you start an
smsto:
intent, also skype will be listed to the user as an sms service.– sulaiMay 9, 2014 at 13:02 -
1
-
@RussellStewart Just wanted to add that I believe an SMS message implies the actual SMS: Short Message Service. Not Internet messages, like Messenger or Whatsapp or others.– DADi590Jan 10, 2022 at 22:55