How to detect if the user has a cellular carrier?

Hi!

I’m having an issue with the Expo Cellular library. I basically want to see if the user is able to handle normal, cellular calls. If they can’t, I’d like to hide the calling feature from the app.

I’ve tried a few methods, none of which seem to work. Here’s what I’ve tried (some non Expo):

  • Linking.canOpenURL("tel:xxxxxxxxx") and "telprompt:xxxxxxxxxx"
  • Cellular.carrier
  • Cellular.isoCountryCode
  • The NetInfo Library. It only shows the currently active connection. So on phones with Cellular that are on WiFi it shows as only WiFi.
  1. SDK Version: 39.0.5 (got from packages.json)
  2. Platforms(Android/iOS/web/all): iOS (other platforms untested)

I’m not sure why Cellular.carrier doesn’t work for me. Well, actually, it works on my specific phone with a specific carrier. My friend with a different carrier shows as null. Is there some reason why it wouldn’t be able to detect that? We compared settings on our devices and found nothing that changed it.

Thank you all so much!

Hey @fiveatoms, what carrier is returning as null? Also, have you tried any other carriers aside from your own and the friend’s which returns null?

Cheers,
Adam

AT&T does not return null—Verizon does. Those are the only carriers I’ve been able to test.

I’ve just tried it on my phone. In my case, allowsVoip is true, carrier is an empty string. All of the other options contain a valid string.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.