实施 eSIM、LPA 示例

问题描述

我正在尝试使用文档 https://source.android.com/devices/tech/connect/esim-overview?hl=en 中的示例编写用于在设备上实现 eSim 的代码测试示例。设备支持 eSim,验证方法 mgr.isEnabled() 返回 true。但是当我尝试调用公共加载方法 downloadSubscription 时没有任何反应,没有调用 onReceive 方法。

static final String ACTION_DOWNLOAD_SUBSCRIPTION = "download_subscription";
static final String LPA_DECLARED_PERMISSION
    = "com.your.company.lpa.permission.BROADCAST";
BroadcastReceiver receiver =
        new BroadcastReceiver() {
            @Override
            public void onReceive(Context context,Intent intent) {
                if (!action.equals(intent.getAction())) {
                    return;
                }
                resultCode = getResultCode();
                detailedCode = intent.getIntExtra(
                    EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE,0 /* defaultValue*/);
                resultIntent = intent;
            }
        };
context.registerReceiver(receiver,new IntentFilter(ACTION_DOWNLOAD_SUBSCRIPTION),LPA_DECLARED_PERMISSION /* broadcastPermission*/,null /* handler */);

// Download subscription asynchronously.
DownloadableSubscription sub = DownloadableSubscription
        .forActivationCode(code /* encodedActivationCode*/);
Intent intent = new Intent(action);
PendingIntent callbackIntent = PendingIntent.getBroadcast(
        getContext(),0 /* requestCode */,intent,PendingIntent.FLAG_UPDATE_CURRENT);
mgr.downloadSubscription(sub,true /* switchAfterDownload */,callbackIntent);

而且我不太明白这里到底需要指定什么"com.your.company.lpa.permission.BROADCAST"我尝试将“com.your.company”更改为我的包名称,但它不起作用

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)