Stephen Hosking
Stephen Hosking

Reputation: 1465

UnsupportedOperationException: Sms is not supported, from SmsManager.sendTextMessage – where previously worked well in production

Overview, July 24, 2023

Nokia C01 Plus, Android 11 Go

The original problem raised here was the exception "Sms is not supported" when sending a message, from an app which has the correct settings and has been working for several weeks.

We have diagnosed this as a complete failure of the SMS system on the phone as if it were an Android device without SMS.

The problem is known to be fixed with a cold reboot of the phone, ie Power Off/ Wait / Power On, rather than "Restart".

A second device has registered the same problem.

Doing a cold restart from software is available on some phones, but not this one.

Original Summary

2023-06-24 04:22:41 [STACK_TRACE]=java.lang.UnsupportedOperationException: Sms is not supported

Raised in code which:

The platform history

I have a product which packages an Android app with a consumer phone, and which sends SMS messages from the app to clients (It also receives them). It's been in production for ten years, and the particular lines of code which caused this problem are more than five years old.

In March 2023 we started deploying the app on the Nokia C01 plus phone, with Android 11 Go. Twenty have been deployed, and this problem arose on one of the more recent deployments in June.

We had considerable problems adapting the app to Android 11 Go. New "Permissions" handling were a problem, but handled. An unsolved problem was that the Nokia C01 Plus tries to push OS updates, and this can't be disabled. We attempted to handle this by disabling wi-fi.

The particular phone with this issue was deployed in May 2023. There are identical models both older and more recent which are continuing to function correctly.

The Problem

This particular phone was working as intended (ie. sending SMS over several weeks) when this exception was raised.

2023-06-24 04:22:41
[STACK_TRACE]=java.lang.UnsupportedOperationException: Sms is not supported
    at android.telephony.SmsManager.getISmsServiceOrThrow(SmsManager.java:1658)
    at android.telephony.SmsManager.getSubscriptionId(SmsManager.java:1520)
    at android.telephony.SmsManager.resolveSubscriptionForOperation(SmsManager.java:1545)
    at android.telephony.SmsManager.sendTextMessageInternal(SmsManager.java:601)
    at android.telephony.SmsManager.sendTextMessage(SmsManager.java:443)
    at au.com.cba.nopowersms.services.SendSmsBase.sendSmsToNumber(SendSmsBase.java:192)
    at

From this line in our code...

Line of code 192 which raises exception

After the exception occurred once, it continued to occur each time the app tried to sent an SMS - until the phone was restarted.

The problem IS NOT:

See the handling of results from SmsManager.sendTextMessage in our log below...

App log shows SMS send result being handled

The problem was “fixed” by restarting the phone. No other changes were made (eg. permissions or network access). With a restart, it simply started sending messages correctly again.

However, our network logs show that their may have been network outages at the time of the failure.

Question 1. Could a network outage cause this exception, where deactivating the SIM on the network is properly handled?

My best guess is that rather than being caused by any network issue the phone operating system or hardware has simply failed, and randomly decided that “SMS is not supported”, as if missing the required hardware. This was fixed by restarting the phone. It may be related to the unwanted pushing of updates. However, the same would apply to other phones released

Question 2. Is this likely, ie. for the phone to erroneously report “SMS is not supported”, to be fixed with a restart?

Question 3. Any other explanations or suggestions?

Further info

After initial post...

Upvotes: 2

Views: 284

Answers (0)

Related Questions