Automatically detect APN for external SIM

Hi,

Why can’t the external SIM mode autodetect the APN? This keeps causing issues for me, since I have to set up the external SIM onshore, but the network isn’t available before offshore. So I can’t test, and apparently the provider doesn’t always provide the right APN or they have several different options.

Regards, Gaute

Hi @gauteh,

My understanding is that the APNs are not stored in the SIMs themselves, so it’s not even technically possible to auto-detect them (although I can definitely see why that would be useful).

I’m not sure if you’ve tried this or not, but you can use the dual-primary-secondary option of the card.wireless API to tell the Notecard to start with the primary SIM and then fallback to the secondary (external) SIM.

Rob

Hi,

If I put this sim in a regular phone it figures out the configuration itself, so it must be possible. I think this is what happens with all sims? I’ve never had to manually configure an apn.

I do use the dual method, but this is an area and network that does not work with the onboard sim.

Thanks, Gaute

Yeah that’s a good point. I did find this Reddit thread that sheds some light on the difference between the process on a smartphone vs embedded systems:

https://www.reddit.com/r/embedded/comments/qfss4x/how_do_phones_know_which_apn_to_use/

1 Like

Thanks, that was very useful. Is there any way I can get the sim info so that I can start working on an apn table for myself?

Not that I’m aware of. One alternative could be to seed an array of possible APNs (assuming you know it’ll be one of them) and then send card.wireless requests that set the APN, check for connectivity after a couple minutes, and repeat until you establish a connection? It’s a bit of a hack, yes.

{
  "req": "card.wireless",
  "apn": "myapn.nb"
}