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

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.



Solution 1:[1]

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

Solution 2:[2]

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.

Solution 3:[3]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharman
Solution 2 Zeerak Hameem
Solution 3 zeh