Skip to content

Commit

Permalink
fix: OAID初始化获取为空后需再次获取,避免一直为空
Browse files Browse the repository at this point in the history
  • Loading branch information
liyujiang-gzu committed Feb 10, 2022
1 parent d26ae1f commit cbbd1e4
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import android.app.Application;
import android.content.Context;
import android.text.TextUtils;

/**
* 设备标识符工具类。
Expand Down Expand Up @@ -51,9 +52,9 @@ public static void register(Application application) {
}

public static String getClientId() {
if (clientId == null) {
if (TextUtils.isEmpty(clientId)) {
synchronized (DeviceIdentifier.class) {
if (clientId == null) {
if (TextUtils.isEmpty(clientId)) {
clientId = DeviceID.getClientIdMD5();
}
}
Expand All @@ -79,9 +80,9 @@ public static String getIMEI(Context context) {
}

public static String getOAID(Context context) {
if (oaid == null) {
if (TextUtils.isEmpty(oaid)) {
synchronized (DeviceIdentifier.class) {
if (oaid == null) {
if (TextUtils.isEmpty(oaid)) {
oaid = DeviceID.getOAID();
if (oaid == null || oaid.length() == 0) {
DeviceID.getOAID(context, new IGetter() {
Expand Down

0 comments on commit cbbd1e4

Please sign in to comment.