Been racking my brain on this for a while and I need some other opinions/possible diagnoses. I have a feature in my app in which a user sends an sms to herself in order to verify her phone number (I know there are better solutions out there, but this is what I'm doing for now). The code I'm using works for most phones but fails in a few cases and I can;t seem to diagnose exactly why. I'm just using the basic SmsManager method:
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNumber, null, "sms verification", null, null);
Here's what I've done to try and find the root of this problem:
Although I'm not going to write it out here, I debugged using a BroadcastReceiver and found that the error the user is receiving in this case is RESULT_ERROR_GENERIC_FAILURE, which doesn't give much in the way of hints on how to debug unfortunately.
I wrote out a separate app which just consists of a button which sends an sms using this method. This app worked in sending a text message to another phone, but failed when trying to send a sms to itself.
I compared the logcats of a phone which successfully sends and sms to itself with a phone that fails and I found this basic difference: when the sms is preparing to send, Android seems to run a configuration using an xml file called featureset.xml. This file includes a list of settings related to SMS on it seems. Though I have no clue what these settings control actually, I did notice that on successful phones, it took this file from /etc/featureset.xml, while on unsuccessful phones it took the file from the location /cust/OPEN_SG/config/featureset.xml. The files contain a lot of the same settings, but there are differences, though even the files on successful devices vary from device to device, so I'm not sure which setting could be the issue. Even if I did know how this file was causing the error, I wouldn't know how to fix that bug.
Long story short, I'm at a loss. Is this just a problem that occurs with a certain percentage of phones when using SmsManager? Is there anything else I'm missing here? Let me know if you have any other ideas as to things I should check in order to properly diagnose this issue. Oh, and BTW, all of the devices, working and failing, are running either KitKat or Lollipop. Thanks.