Skip to content

Commit

Permalink
Release 1.6.22
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzhzh committed Oct 24, 2016
1 parent af03de5 commit 21057a8
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 16 deletions.
2 changes: 1 addition & 1 deletion SensorsAnalyticsSDK/SensorsAnalyticsSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

version = "1.6.21"
version = "1.6.22"

android {
compileSdkVersion 21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,24 @@ String getProfileName() {

final String packageName = context.getApplicationContext().getPackageName();

{
//中国移动
sCarrierMap.put("46000", " 中国移动");
sCarrierMap.put("46002", " 中国移动");
sCarrierMap.put("46007", " 中国移动");
sCarrierMap.put("46008", " 中国移动");

//中国联通
sCarrierMap.put("46001", " 中国联通");
sCarrierMap.put("46006", " 中国联通");
sCarrierMap.put("46009", " 中国联通");

//中国电信
sCarrierMap.put("46003", " 中国电信");
sCarrierMap.put("46005", " 中国电信");
sCarrierMap.put("46011", " 中国电信");
}

try {
final ApplicationInfo appInfo = context.getApplicationContext().getPackageManager()
.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
Expand Down Expand Up @@ -211,16 +229,12 @@ String getProfileName() {
.TELEPHONY_SERVICE);
String operatorString = telephonyManager.getSimOperator();

if (operatorString == null) {
// DO NOTHING
} else if (operatorString.equals("46000") || operatorString.equals("46002")) {
deviceInfo.put("$carrier", "中国移动");
} else if (operatorString.equals("46001")) {
deviceInfo.put("$carrier", "中国联通");
} else if (operatorString.equals("46003")) {
deviceInfo.put("$carrier", "中国电信");
} else {
deviceInfo.put("$carrier", "其他");
if (!TextUtils.isEmpty(operatorString)) {
if (sCarrierMap.containsKey(operatorString)) {
deviceInfo.put("$carrier", sCarrierMap.get(operatorString));
} else {
deviceInfo.put("$carrier", "其他");
}
}
}

Expand Down Expand Up @@ -1404,7 +1418,7 @@ private static void mergeJSONObject(final JSONObject source, JSONObject dest)
static final int VTRACK_SUPPORTED_MIN_API = 16;

// SDK版本
static final String VERSION = "1.6.21";
static final String VERSION = "1.6.22";

static Boolean ENABLE_LOG = false;

Expand All @@ -1415,6 +1429,7 @@ private static void mergeJSONObject(final JSONObject source, JSONObject dest)
// Maps each token to a singleton SensorsDataAPI instance
private static final Map<Context, SensorsDataAPI> sInstanceMap = new HashMap<Context, SensorsDataAPI>();
private static final SharedPreferencesLoader sPrefsLoader = new SharedPreferencesLoader();
private static final Map<String, String> sCarrierMap = new HashMap<>();

// Configures
/* SensorsAnalytics 地址 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,12 @@ public Boolean isWifiConnected() {
.checkCallingOrSelfPermission(Manifest.permission.ACCESS_NETWORK_STATE)) {
ConnectivityManager connManager =
(ConnectivityManager) this.mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo wifiInfo = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
ret = wifiInfo.isConnected();
if (connManager != null) {
NetworkInfo wifiInfo = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
if (wifiInfo != null) {
ret = wifiInfo.isConnected();
}
}
}

return ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ public static String networkType(Context context) {
// Wifi
ConnectivityManager manager = (ConnectivityManager)
context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnectedOrConnecting()) {
return "WIFI";
if (manager != null) {
NetworkInfo networkInfo = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
if (networkInfo != null && networkInfo.isConnectedOrConnecting()) {
return "WIFI";
}
}

// Mobile network
Expand Down

0 comments on commit 21057a8

Please sign in to comment.