add oaid工具

This commit is contained in:
cyh 2024-12-13 23:23:24 +08:00
parent ac32061c93
commit c0e8cf7592
4 changed files with 44 additions and 24 deletions

View File

@ -104,8 +104,11 @@ dependencies {
implementation("com.github.bumptech.glide:glide:4.13.2")
// implementation("com.luozm.captcha:captcha:1.1.2")
implementation("com.aliyun.dpa:oss-android-sdk:2.9.19")
// implementation ("com.hihonor.mcs:ads-identifier:1.0.3.301")
implementation("com.github.gzu-liyujiang:Android_CN_OAID:4.2.8") {
exclude("com.huawei.mcs", "ads-identifier")
exclude("com.huawei.hms", "ads-identifier")
}
}

View File

@ -7,7 +7,6 @@ import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.provider.Settings
import android.text.TextUtils
import android.util.Log
import android.view.View
import android.view.WindowManager
@ -16,18 +15,12 @@ import androidx.annotation.RequiresApi
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import com.yingmao.clash.view.dialog.RxDialogSureCancel
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.customview.customView
import com.fm.openinstall.OpenInstall
import com.fm.openinstall.listener.AppInstallListener
import com.fm.openinstall.model.AppData
import com.google.gson.Gson
import com.github.gzuliyujiang.oaid.DeviceID
import com.github.gzuliyujiang.oaid.DeviceIdentifier
import com.github.gzuliyujiang.oaid.IGetter
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import com.yingmao.clash.net.http.entity.RegisterRsp
import com.orhanobut.logger.Logger
import com.tencent.mmkv.MMKV
import com.yingmao.clash.BuildConfig
@ -40,32 +33,23 @@ import com.yingmao.clash.conf.BZYConstants.Companion.MMKV_KEY_IS_REGISTER
import com.yingmao.clash.conf.BZYConstants.Companion.MMKV_KEY_NOTE_DEFAULT_PSW
import com.yingmao.clash.conf.BZYConstants.Companion.MMKV_KEY_REMEMBER_PASSWORD
import com.yingmao.clash.conf.BZYConstants.Companion.MMKV_KEY_REMEMBER_USERNAME
import com.yingmao.clash.conf.Conf
import com.yingmao.clash.entity.CheckLoginRsp
import com.yingmao.clash.listener.AsyncCallback
import com.yingmao.clash.net.http.HttpReqType
import com.yingmao.clash.net.http.HttpStatus
import com.yingmao.clash.net.http.entity.LoginRsp
import com.yingmao.clash.net.http.entity.RegisterRspOld
import com.yingmao.clash.net.http.entity.SubscriptionRsp
import com.yingmao.clash.net.http.entity.RegisterRsp
import com.yingmao.clash.service.ClashManager
import com.yingmao.clash.service.model.Profile
import com.yingmao.clash.service.remote.IClashManager
import com.yingmao.clash.service.remote.wrap
import com.yingmao.clash.util.AESUtil
import com.yingmao.clash.util.Utils
import com.yingmao.clash.util.withProfile
import com.yingmao.clash.view.RxToast
import com.yingmao.clash.view.dialog.RxDialogSureCancel
import com.yingmao.clash.vm.SplashAtyVM
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.util.*
import kotlin.collections.HashSet
import kotlin.system.exitProcess
import java.util.Locale
class SplashActivity : BaseActivity() {
@ -125,6 +109,21 @@ class SplashActivity : BaseActivity() {
// }
// })
// DeviceID.getOAID(this, object : IGetter {
// override fun onOAIDGetComplete(result: String) {
// // 不同厂商的OAID/AAID格式是不一样的可进行MD5、SHA1之类的哈希运算统一
// com.yingmao.clash.common.log.Log.d("onOAIDGetComplete result==>${result}")
// }
//
// override fun onOAIDGetError(error: Exception) {
// // 获取OAID/AAID失败
// error.printStackTrace()
// }
// })
com.yingmao.clash.common.log.Log.d("onOAIDGetComplete result==>${ DeviceIdentifier.getOAID(this)}")
var clashBinder = MainApplication.getApp()?.let {
ClashManager(it).wrap() as IClashManager
}

View File

@ -12,6 +12,7 @@ import androidx.core.app.NotificationChannelCompat
import androidx.core.app.NotificationManagerCompat
import androidx.core.content.getSystemService
import com.fm.openinstall.OpenInstall
import com.github.gzuliyujiang.oaid.DeviceIdentifier
import com.orhanobut.logger.Logger
import com.tencent.mmkv.MMKV
import com.yingmao.clash.R
@ -60,6 +61,9 @@ class MainApplication : Application() {
override fun onCreate() {
super.onCreate()
mApp = this
// if (privacyPolicyAgreed) {
DeviceIdentifier.register(this);
// }
Global.init(this)
val processName = currentProcessName
extractGeoFiles()

View File

@ -7,6 +7,8 @@ import java.util.*
buildscript {
val agp_version by extra("7.4.1")
repositories {
mavenCentral()
google()
maven("https://raw.githubusercontent.com/MetaCubeX/maven-backup/main/releases")
@ -14,6 +16,12 @@ buildscript {
maven("https://maven.aliyun.com/repository/google/")
maven("https://maven.aliyun.com/repository/jcenter/")
maven("https://maven.aliyun.com/repository/central/")
// JitPack 远程仓库
maven("https://jitpack.io")
maven("https://developer.huawei.com/repo")
maven("https://developer.hihonor.com/repo")
}
dependencies {
classpath(libs.build.android)
@ -26,6 +34,7 @@ buildscript {
subprojects {
repositories {
mavenCentral()
google()
maven("https://raw.githubusercontent.com/MetaCubeX/maven-backup/main/releases")
@ -33,6 +42,11 @@ subprojects {
maven("https://maven.aliyun.com/repository/google/")
maven("https://maven.aliyun.com/repository/jcenter/")
maven("https://maven.aliyun.com/repository/central/")
// JitPack 远程仓库
maven("https://jitpack.io")
maven("https://developer.huawei.com/repo")
maven("https://developer.hihonor.com/repo")
}
val isApp = name == "app"