To recreate the behavior
- On Android 6+ device, open cht-android
1.0.0+ app using a brand that does not have the SEND_SMS permission enabled
- Unbranded version does not have
SEND_SMS permission enabled
- Connect to a CHT instance that is
< 3.9.0
- Submit app form that does not have any
xml2sms configuration set
- See prominent disclosure page for SMS permission
- Press "Allow"
- No prompt for SMS permission is displayed. Instead the Android system settings for the CHT app are opened.
- You have to press the back button to return to the CHT app
Basically, the sending report as SMS functionality is getting triggered unintentionally and this is inadvertently triggering the SMS permission request which fails because the app does not have SEND_SMS permission enabled.
Details
Due to medic/cht-core#6162, submitting a report in cht-android for CHT versions < 3.9.0 will always trigger an SMS record for the report to be sent regardless of the xml2sms configuration for the form. In older versions of cht-android, if your brand was not configured with the SEND_SMS this send-attempt would always cause an error that was handled silently by the app (but visible in the adb logs).
In cht-android 1.0.0, we updated handling for the SEND_SMS permission to properly request permission from the user when trying to send a report via sms. BUT this only works when the SEND_SMS permission has been configured for the app brand. The idea is that to send reports via sms this is what is needed:
- Publish cht-android app with
SEND_SMS permission registered
- Configure form with
xml2sms value
- User approves permission request when prompted by app (should happen the first time the app tries to send a report via sms).
Unfortunately, when connecting to a < 3.9.0 CHT server, #2 is bypassed (because of the above-linked issue). Then, if #1 is not done (since presumably you do not want to use the xml2sms feature), the app cannot actually request the permission from the user in #3. When that logic fails in #3, it falls back to re-directing the user to the Android settings to manually set the permission for the app. However, in this case, without #1, it is actually impossible to set the permission (and no prompt is shown to the user for how to proceed). This will continue to happen each time a report is submitted.
Workaround
The good news is that I have identified a workaround that does not require updates to cht-core or cht-android. To avoid experiencing this issue when using cht-android 1.0.0+ to connect to a CHT server that is < 3.9.0, you can set the xml2sms configuration on all your forms to "xml2sms": "false". (It needs to be the string "false" and not just the boolean primitive false.) This will prevent the behavior from medic/cht-core#6162 and new reports submitted for those forms will NOT trigger the SMS workflow at all.
To recreate the behavior
1.0.0+app using a brand that does not have theSEND_SMSpermission enabledSEND_SMSpermission enabled< 3.9.0xml2smsconfiguration setBasically, the sending report as SMS functionality is getting triggered unintentionally and this is inadvertently triggering the SMS permission request which fails because the app does not have
SEND_SMSpermission enabled.Details
Due to medic/cht-core#6162, submitting a report in cht-android for CHT versions
< 3.9.0will always trigger an SMS record for the report to be sent regardless of thexml2smsconfiguration for the form. In older versions of cht-android, if your brand was not configured with theSEND_SMSthis send-attempt would always cause an error that was handled silently by the app (but visible in the adb logs).In cht-android
1.0.0, we updated handling for theSEND_SMSpermission to properly request permission from the user when trying to send a report via sms. BUT this only works when theSEND_SMSpermission has been configured for the app brand. The idea is that to send reports via sms this is what is needed:SEND_SMSpermission registeredxml2smsvalueUnfortunately, when connecting to a
< 3.9.0CHT server,#2is bypassed (because of the above-linked issue). Then, if#1is not done (since presumably you do not want to use thexml2smsfeature), the app cannot actually request the permission from the user in#3. When that logic fails in#3, it falls back to re-directing the user to the Android settings to manually set the permission for the app. However, in this case, without#1, it is actually impossible to set the permission (and no prompt is shown to the user for how to proceed). This will continue to happen each time a report is submitted.Workaround
The good news is that I have identified a workaround that does not require updates to cht-core or cht-android. To avoid experiencing this issue when using cht-android
1.0.0+to connect to a CHT server that is< 3.9.0, you can set thexml2smsconfiguration on all your forms to"xml2sms": "false". (It needs to be the string"false"and not just the boolean primitivefalse.) This will prevent the behavior from medic/cht-core#6162 and new reports submitted for those forms will NOT trigger the SMS workflow at all.