这是我们从 Mopub 和其他广告网络看到的:
java.io.IOException:连接失败 com.google.android.gms.ads.identifier.AdvertisingIdClient.g(未知来源) com.google.android.gms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo(未知来源)
他们似乎都有同样的问题。
奇怪的是,我们可以通过以下来源从我们的应用程序中获取广告 ID。我们获得了正确的广告 ID,并且没有错误日志。所有 SDK 都遇到相同的问题(连接失败)。
任何帮助表示赞赏。
private void getAdvertisingId(AdvertisingIdHolder receiver) {
AdvertisingIdClient.Info adInfo = null;
String id = null;
boolean isLAT = false;
try {
adInfo = AdvertisingIdClient.getAdvertisingIdInfo(App.getCtx());
id = adInfo.getId();
isLAT = adInfo.isLimitAdTrackingEnabled();
} catch (IOException e) {
SLog.e("error", e);
// Unrecoverable error connecting to Google Play services (e.g.,
// the old version of the service doesn't support getting AdvertisingId).
} catch (GooglePlayServicesNotAvailableException e) {
SLog.e("error", e);
// Google Play services is not available entirely.
} catch (GooglePlayServicesRepairableException e) {
e.printStackTrace();
}
receiver.receive(id, isLAT);
}