首页 / 浏览问题 / 移动GIS / 问题详情
License Error Code 1416
mxc
112EXP 2023年11月11日

使用产品:supermap-imobile-11.1.1-android-chs-

操作系统:android
数据类型: 文件型
问题详细描述:代码申请使用许可 失败
问题重现步骤: 

1. 代码调用登录:

cloudLicenseManager.login(username, password);

2. 在 LicenseLoginCallback 的 loginAccount() 回调里调用

cloudLicenseManager.applyTrial();

然后就在 LicenseLoginCallback 的 otherError() 里收到错误

License Error Code 1416

              try {
                    Log.i("SuperMapManager", task+" loginSuperMap: LicensePath="+directory.getAbsolutePath());
                    com.supermap.data.Environment.setLicensePath(directory.getAbsolutePath());
                } catch (Exception e) {
                    e.printStackTrace();
                    LogUtils.log(SuperMapManager.class.getSimpleName(), "initSuperMap:  设置许可文件路径错误,需要去下载");
                }

                com.supermap.data.Environment.setWebCacheDirectory(webCacheDir.getAbsolutePath());
                com.supermap.data.Environment.setTemporaryPath(tempDir.getAbsolutePath());
                com.supermap.data.Environment.setLanguage(com.supermap.data.Environment.Language.CHINESE);
                com.supermap.data.Environment.initialization(CommonUtils.context);
                final CloudLicenseManager cloudLicenseManager = CloudLicenseManager.getInstance(CommonUtils.context);
                Log.i("SuperMapManager", "initializationSuperMap: userName="+username+" ; password="+password +" ;task="+task);
                cloudLicenseManager.setLoginCallback(new CloudLicenseManager.LicenseLoginCallback() {
                    @Override
                    public void loginAccount(boolean b) {
                        Log.i("SuperMapManager", task+ " loginAccount: "+b);
//                        mMainHandle.obtainMessage(WHAT_INITIALIZATION_SUCCESS).sendToTarget();
//                        cloudLicenseManager.queryLicense();
                        cloudLicenseManager.applyTrial();
                    }

                    @Override
                    public void logoutAccount(boolean b) {
                        Log.i("SuperMapManager", task+"logoutAccount: "+b);
                    }

                    @Override
                    public void queryLicense(QueryFormalLicenseResponse queryFormalLicenseResponse) {
                        Log.i("SuperMapManager", task+" queryLicense: "+(queryFormalLicenseResponse!=null?queryFormalLicenseResponse.formal:"null"));
                        if (null != queryFormalLicenseResponse){
                            LicenseInfo[] licenses = queryFormalLicenseResponse.licenses;
                            if (null != licenses && licenses.length>0){
                                for (LicenseInfo licenseInfo:licenses){
                                    Log.i("SuperMapManager", task+" queryLicense: id="+licenseInfo.id+"; version="+licenseInfo.version+"; 剩余天数="+licenseInfo.remainDays);
                                }
                            }
                        }
                    }

                    @Override
                    public void activeLicense(String s) {
                        Log.i("SuperMapManager", task+" activeLicense: "+s);
                    }

                    @Override
                    public void activeTriaLicense() {
                        Log.i("SuperMapManager", "activeTriaLicense: "+task);
                    }

                    @Override
                    public void recycleLicense(int i) {
                        Log.i("SuperMapManager", task+" recycleLicense: "+i);
                    }

                    @Override
                    public void otherError(String s) {
                        Log.i("SuperMapManager", task+"  otherError: "+s);
                        mMainHandle.obtainMessage(WHAT_INITIALIZATION_FAIL,CommonConstants.CODE.ERROR_OTHER, 0, s)
                                .sendToTarget();
                    }

                });
                cloudLicenseManager.login(username, password);

麻烦帮忙处理一下

1个回答

您好,麻烦确认下使用的imobile版本是否是11.1.1呢,这边在imobile 11.1.1版本中没有找到cloudLicenseManager.applyTrial()这个方法,cloudLicenseManager中只有applyFormal()这个方法
3,685EXP 2023年11月13日

你好,我这边可以确认是 11.1.1 ,使用jar 和面都带着版本号是 1111 com.supermap.data_v1111.jar

另外,我这边原本使用使用许可是直接在放到sdcard里设置给SDK路径就行了,现在你们这个使用许可方法改了,我这边应该怎么操作呢?

按照 https://doc.supermapol.com/zh-hans/TrialLicense/onlinetrial.html 这个网址里的方式,我这边使用的是 imboile ,只需要登录上就可以了吗?

String rootPath = android.os.Environment.getExternalStorageDirectory().getAbsolutePath();
Environment.setLicensePath(rootPath + "/SuperMap/License");
CloudLicenseManager cloudLicM = CloudLicenseManager.getInstance(this);
String username = "您的Online用户名";
String password = "您的Online登陆密码";
cloudLicM.setLoginCallback(new CloudLicenseManager.LicenseLoginCallback() {
@Override
public void loginSuccess(LicenseStatus arg0) {
// TODO Auto-generated method stub
showMessage("云许可登陆成功: " + arg0.toString());
}
@Override
public void loginFailed(String arg0) {
// TODO Auto-generated method stub
showMessage("云许可登陆失败: " + arg0);
}
});
cloudLicM.login(username, password);

登录上之后还需要查询可用模块,选择可用模块激活,可以参考以下代码:

        CloudLicenseManager cloudLicenseManager=CloudLicenseManager.getInstance(this);
        cloudLicenseManager.setLoginCallback(new CloudLicenseManager.LicenseLoginCallback() {
            @SuppressLint("LongLogTag")
            @Override
            public void loginAccount(boolean issuccess) {
                Log.i(TAG,"登录:"+issuccess);
                cloudLicenseManager.queryLicense();
//                cloudLicenseManager.applyFormal();
            }

            @Override
            public void logoutAccount(boolean logout) {

            }

            @SuppressLint("LongLogTag")
            @Override
            public void queryLicense(QueryFormalLicenseResponse queryFormalLicenseResponse) {
                cloudLicenseManager.applyFormal(queryFormalLicenseResponse.licenses[0].id);
                Log.i(TAG,"查询许可:"+queryFormalLicenseResponse.licenseCount);
            }

            @SuppressLint("LongLogTag")
            @Override
            public void activeLicense(String returnId) {
                Log.i(TAG,"归还许可号:"+returnId);
                Log.i(TAG,"许可状态:"+openWorkspace(android.os.Environment.getExternalStorageDirectory().getAbsolutePath()+"/SampleData/GeometryInfo/World.smwu",WorkspaceType.SMWU));
            }

            @Override
            public void recycleLicense(int days) {

            }

            @SuppressLint("LongLogTag")
            @Override
            public void otherError(String error) {
                Log.i(TAG,"错误:"+error);
            }
        });
        cloudLicenseManager.login("account","password");
...