I know this might be a stupid question, but can we detect whether an iPhone device has a case and screen protector on it in code?
Asked
Active
Viewed 114 times
2 Answers
4
Enable the microphone and then vibrate the device. If you have a baseline idea of how the audio frequency looks without a bumper, then you can diff that against what you record.
Typically, the cases are made out of materials like silicone that reduce the intensity of the vibration sound.

CodeBender
- 35,668
- 12
- 125
- 132
-
1Interesting idea, I imagine this works best when the phone is on a hard surface but not so well if held in hand – Joni Mar 21 '19 at 23:13
-
@Joni Definitely a valid point, since users do tend to hold their phones. – CodeBender Mar 21 '19 at 23:53
1
I don’t think so. Screen protectors and cases are made with sensors in mind, so they don’t interfere with proximity sensors cameras, or microphones, which I think is the only way we have to know if there’s something on the phone.
Battery cases, or lightning accessories are something else though, but I don’t think you are talking about those.

Renzo Tissoni
- 642
- 9
- 21
-
1I am trying if I can get something different from 3D touch events, but it looks all data is the same with or without screen protector..... – Yibin Feng Mar 22 '19 at 04:12
-
3DTouch registers from a specific pressure. I think it would take the user a bit more force to press the screen with a screen protector on, but 3DTouch wouldn't really care about it. – Renzo Tissoni Mar 22 '19 at 13:04