| | |
| | | package com.hdl.sdk.common; |
| | | |
| | | import android.content.Context; |
| | | import android.content.pm.PackageInfo; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | public String getVersion() { |
| | | return version; |
| | | try { |
| | | PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); |
| | | String versionName = packageInfo.versionName; // 版本名称(字符串) |
| | | return versionName; |
| | | } catch (Exception e) { |
| | | LogUtils.e("获取版本失败:" + e.getMessage()); |
| | | } |
| | | return "unknow"; |
| | | } |
| | | |
| | | private String version = "1.1.6"; |
| | | // private String version = "1.1.7"; |
| | | |
| | | private HDLSdk() { |
| | | } |
| | |
| | | this.context = context.getApplicationContext(); |
| | | HDLAuthSocket.getInstance().init(); |
| | | HDLSocket.getInstance().broadcastRequest(); |
| | | LogUtils.i("HDLSdk Version:" + version); |
| | | LogUtils.i("HDLSdk Version:" + getVersion()); |
| | | |
| | | //订阅所有的主题 |
| | | HDLLink.getInstance().registerAllTopicsListener(new EventListener() { |