Skip to content

[SMS Plugin] Fix reading SMS/MMS on devices with no `sub_id`

Krzysztof Dziembała requested to merge (removed):master into master

Summary

SMS history didn't work on some devices (eg. Xiaomi Mi 4S running Android Nougat 7.0), because, despite SDK >= 22, these devices don't support Telephony.Sms.SUBSCRIPTION_ID and instead (probably) use "sim_id".

To avoid this situation now a check is performed to make sure that this column exists and query won't fail due to this issue.

Partially fixes bug #401677

Test Plan

Before:

SMS history couldn't be read, because query with "sub_id" column would fail every time and throw an error.

After:

SMS history now can be read on affected devices and if Telephony.Sms.SUBSCRIPTION_ID is not supported, subscriptionID is set to 0.

Edited by Krzysztof Dziembała

Merge request reports

Loading