Closed grzesiek2010 closed 1 year ago
I've discovered this issue working on https://github.com/getodk/collect/issues/4838 but it's not related (it doesn't have the same root cause).
@grzesiek2010 is this broken across API levels?
is this broken across API levels?
Yes, all devices and all android versions. I wonder how it is possible that no one had noticed that earlier.
I'm thinking we should get this out as a hotfix then. Do you agree?
I'm thinking we should get this out as a hotfix then. Do you agree?
Theoretically it's an obvious bug that should be fixed but it's not new, it's been like that for more than a year at least. So I'm not sure @lognaturel what do you think?
From @grzesiek2010 in #5481:
Wow, I've tested it on emulators so everything was fine but I can confirm it's not always the case with real devices. One problem is that on newer devices an exception might be thrown which I could handle with the fix we already have in https://github.com/getodk/collect/pull/5483. But even if I do that an empty string is returned instead of the number I want. I've tried the current implementation with TelephonyManager, and also another one with SubscriptionManager and it's the same. Browsing StackOverflow I see that people claim there is no one perfect and reliable solution to read a phone number. Taking that into account and the fact that it has been broken for more than 2 years and no one has complained, maybe we should remove that at all and just let users enter their numbers manually? @lognaturel @seadowg what do you think?
Do we think getting the phone number has been broken on every device or will it have worked on some (with the existing implementation)?
Do we think getting the phone number has been broken on every device or will it have worked on some (with the existing implementation)?
It has been broken on all devices. With my fix maybe it would work on some I don't know because we checked some real devices to no avail and it worked well only on emulators.
We've known automatically getting phone number was not consistently possible for some time so it makes sense to me that we didn't notice it was more broadly broken. As far as I know it has never been very broadly used and I think it's ok to explicitly remove ~, especially if it requires scary permissions~ .
I'm going to give this some more thought before we talk Tues.
We have decided to fully remove automatically getting phone numbers. We'll need to update some docs as well.
Problem description
The device's phone number can't be read. If we set the phone number in settings on our own it works well.
Steps to reproduce the problem
Install a fresh version of ODK Collect
Go to Settings -> User and device identity -> Form metadata
Phone number should be displayed but we have
Not available
instead.Open the attached form: metadata.xlsx
Phone number should be displayed in
phonenumber
question.