'Is it possible to emulate esim on AVD?

I've created a simple native module for React Native to see if the phone supports eSim. I've used this instruction Here's the module's code.

package com.nativetest;
import android.app.assist.AssistStructure;
import android.content.Context;
import android.os.Build;
import android.telephony.euicc.EuiccManager;
import android.util.Log;

import androidx.annotation.RequiresApi;

import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;

public class EsimModule extends ReactContextBaseJavaModule {
    private static ReactApplicationContext reactContext;

    EsimModule(ReactApplicationContext context) {
        super(context);
        reactContext = context;
    }

    @RequiresApi(api = Build.VERSION_CODES.P)
    @ReactMethod
    public void checkIfEsimEnabled() {
        EuiccManager mgr = (EuiccManager) reactContext.getSystemService(Context.EUICC_SERVICE);
        assert mgr != null;
        Log.d("EsimModule", "Is Esim enabled " + mgr.isEnabled());
        mgr.isEnabled();
    }

    @Override
    public String getName() {
        return "Esim";
    }


}

The problem is that when I run my app on emulator (Google Pixel 3a, API 30), the result of mgr.isEnabled() is always false, so I can't check if I get the right data on RN side. Is there a way to configure an emulator with eSim support?



Sources

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

Source: Stack Overflow

Solution Source