如果在App中使用了Admob Eu consent loadForm,而在部分设备上会导致程序崩溃,则可能是由于loadForm方法在UIThread上执行而导致的。解决方法是将loadForm方法放入新的线程中执行,代码示例如下:
new Thread(new Runnable() { @Override public void run() { form = new ConsentForm.Builder(context, privacyUrl) .withListener(new ConsentFormListener() { @Override public void onConsentFormLoaded() {
}
@Override
public void onConsentFormOpened() {
}
@Override
public void onConsentFormClosed(
ConsentStatus consentStatus,
Boolean userPrefersAdFree) {
}
@Override
public void onConsentFormError(String errorDescription) {
}
})
.withPersonalizedAdsOption()
.withNonPersonalizedAdsOption()
.withAdFreeOption()
.build();
form.load();
}
}).start();