How to check for esim eligibility in react-native app?

1.4k Views Asked by At

I need to make a react-native app that checks if the device is suitable for esim or not.

I obtain this information https://source.android.com/devices/tech/connect/esim-overview to setup esim but cannot figure out how to implement it in real code. I am trying to use EuiccManager to check whether it supports esim or not?

Please, could you help me?

I tried to take reference from this class EuiccManager but do not find how to use this in react native.

4

There are 4 best solutions below

0
On

I recently came across this problem. What I did was, I had already added react-native-deviceinfo library.

So I queried the device name from it and check whether the device name lies within the following list

DeviceInfo.getDeviceName().then(deviceName => {});
  1. Iphone Xr
  2. Iphone Xs / Xs Max
  3. Iphone 11/ 11 Pro / 11 Pro Max
  4. Google Pixel 3/ 3 XL / 3a XL / 4

As we know these are the devices which are currently supporting eSims.

This is a temporary solution a though and the list will need managing once a new eSim device is launched.

0
On

I used this package to see if esim is available: https://github.com/odemolliens/react-native-sim-cards-manager

They have a function to check if esim is avaialable:

import SimCardsManagerModule from 'react-native-sim-cards-manager';

SimCardsManagerModule.isEsimSupported()
  .then((isSupported: boolean) => {
    //
})
.catch((error) => {
  //
});
0
On

There's no current React Native library for it. So you need to build a Native module that forwards all calls from JS land to EuiccManager. It's not that difficult, but requires some Android Studio/Java work, is a bit long to explain, and can change over time, so checking the official documentation is your best bet. At least until someone creates a third-party library that does the work for you.

0
On

You should be do a petition to the Android API with a native module. You can not use javascript for it.