1

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?

shim
  • 9,289
  • 12
  • 69
  • 108
Yibin Feng
  • 63
  • 1
  • 1
  • 4

2 Answers2

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
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
  • 1
    I 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