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.
To confirm that Verified SMS is enabled on your device, open the Messages app, tap the more_vert button, then tap Settings. If Verified SMS appears in Settings, Verified SMS is enabled on your device. If Verified SMS doesn't appear in Settings, Verified SMS isn't enabled on your device.
Sending an SMS message is permission-protected. Your app can't use SMS without the SEND_SMS permission line in AndroidManifest. xml. This permission line enables a setting for the app in the Settings app that gives the user the choice of allowing or disallowing use of SMS.
AFAIK you cannot detect which app is sending the SMS. It's just not saved in the content storage. However, you could use an error-prone workaround: list all apps currently running which have the SEND_SMS permission (possibly with internet permission as well) when the SMS is sent.
if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) { // THIS PHONE HAS SMS FUNCTIONALITY } else { // NO SMS HERE :( }
That should work for API Level 5 and above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With