From 40ec4fe744e12eafdf5e35c9449ba56976f54468 Mon Sep 17 00:00:00 2001 From: Hemant Mann Date: Fri, 21 Jan 2022 13:29:05 +0530 Subject: [PATCH] update: remove hardware ids --- TrackierSDK/gradle.properties | 4 +-- TrackierSDK/sdk-core/build.gradle | 4 +-- .../main/java/com/trackier/sdk/Constants.kt | 2 +- .../main/java/com/trackier/sdk/DeviceInfo.kt | 31 ++----------------- 4 files changed, 7 insertions(+), 34 deletions(-) diff --git a/TrackierSDK/gradle.properties b/TrackierSDK/gradle.properties index dd48a5b..9d84f46 100644 --- a/TrackierSDK/gradle.properties +++ b/TrackierSDK/gradle.properties @@ -20,8 +20,8 @@ POM_DEVELOPER_ID=trackier POM_DEVELOPER_NAME=Trackier PUBLISH_DEVELOPER_EMAIL=dev@trackier.com POM_LICENCE_DIST=repo -VERSION_CODE=19 -VERSION_NAME=1.6.16 +VERSION_CODE=20 +VERSION_NAME=1.6.17 GROUP=com.trackier POM_SCM_DEV_CONNECTION=scm\:git@github.com\:trackier/android_sdk.git POM_LICENCE_NAME=The Apache Software License, Version 2.0 diff --git a/TrackierSDK/sdk-core/build.gradle b/TrackierSDK/sdk-core/build.gradle index 4f61acf..8d8d638 100644 --- a/TrackierSDK/sdk-core/build.gradle +++ b/TrackierSDK/sdk-core/build.gradle @@ -25,8 +25,8 @@ android { defaultConfig { minSdkVersion 16 targetSdkVersion 30 - versionCode 19 - versionName "1.6.16" + versionCode 20 + versionName "1.6.17" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" diff --git a/TrackierSDK/sdk-core/src/main/java/com/trackier/sdk/Constants.kt b/TrackierSDK/sdk-core/src/main/java/com/trackier/sdk/Constants.kt index d77c359..ad880e1 100644 --- a/TrackierSDK/sdk-core/src/main/java/com/trackier/sdk/Constants.kt +++ b/TrackierSDK/sdk-core/src/main/java/com/trackier/sdk/Constants.kt @@ -1,7 +1,7 @@ package com.trackier.sdk object Constants { - const val SDK_VERSION = "1.6.16" + const val SDK_VERSION = "1.6.17" const val USER_AGENT = "com.cloudstuff.trackiersdk:trackier-android:" + SDK_VERSION const val API_VERSION = "v1" const val BASE_URL = "https://events.trackier.io/" + API_VERSION + "/" diff --git a/TrackierSDK/sdk-core/src/main/java/com/trackier/sdk/DeviceInfo.kt b/TrackierSDK/sdk-core/src/main/java/com/trackier/sdk/DeviceInfo.kt index c668b41..9560f6c 100644 --- a/TrackierSDK/sdk-core/src/main/java/com/trackier/sdk/DeviceInfo.kt +++ b/TrackierSDK/sdk-core/src/main/java/com/trackier/sdk/DeviceInfo.kt @@ -1,6 +1,5 @@ package com.trackier.sdk -import android.annotation.SuppressLint import android.content.ContentResolver import android.content.Context import android.content.pm.PackageManager @@ -57,8 +56,8 @@ data class DeviceInfo( var connectionType: String? = null var countryCode: String? = null var carrier: String? = null - var macMd5: String? = null - var androidId: String? = null + var macMd5: String? = null // removed + var androidId: String? = null // removed var isEmulator = false var locale: String? = "" @@ -86,9 +85,7 @@ data class DeviceInfo( deviceInfo.connectionType = getConnectionType(context) setCarrierInfo(deviceInfo, context) - deviceInfo.macMd5 = getMacAddress(context) deviceInfo.isEmulator = checkIsEmulator() - deviceInfo.androidId = getAndroidID(context) deviceInfo.fbAttributionId = getFBAttributionId(context.contentResolver) @@ -198,30 +195,6 @@ data class DeviceInfo( } } - @SuppressLint("HardwareIds") - private fun getMacAddress(context: Context): String? { - return try { - // for devices above android v6 - val wlanAddress = Util.loadAddress("wlan0") - if (wlanAddress?.isBlank() == false) { - return Util.md5(wlanAddress.trim().toUpperCase(Locale.US)) - } - // this works below android v6 - val manager = context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager? - val info = manager?.connectionInfo - val mac = info?.macAddress?.trim()?.toUpperCase(Locale.US) - if (mac == "02:00:00:00:00:00" || mac?.length == 0) null else Util.md5(mac!!) - } catch (ex: Exception) { - null - } - } - - @SuppressLint("HardwareIds") - private fun getAndroidID(context: Context): String { - return Settings.Secure.getString(context.contentResolver, - Settings.Secure.ANDROID_ID) - } - private fun setCarrierInfo(deviceInfo: DeviceInfo, context: Context) { try { val tm = context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager?