我正在尝试实施同意菜单以符合GDPR法规(通用数据保护法规)。 当设备的位置在欧盟范围内时,我需要用户决定是否从Appodeal接收个性化广告。 所以我用:
String[] publisherIds = {"pub-XXXXXXXXXXXXXXXX"}; // My admob Publisher ID
ConsentInformation consentInformation = ConsentInformation.getInstance(this);
consentInformation.requestConsentInfoUpdate(publisherIds, new ConsentInfoUpdateListener() {
@Override
public void onConsentInfoUpdated(ConsentStatus consentStatus) {
if (ConsentInformation.getInstance(SplashActivity.this).isRequestLocationInEeaOrUnknown()) {
startActivity(new Intent(SplashActivity.this, GDPRActivity.class));
} else {
startMainActivityWithDefaultConsent();
}
}
@Override
public void onFailedToUpdateConsentInfo(String errorDescription) {
startMainActivityWithDefaultConsent();
}
});
事件监听器 requestConsentInfoUpdate 应该能够检测用户何时更改“退出广告个性化设置” 的状态(通过 启用或禁用它)。但是,当我运行该应用程序时,它会完全绕过 requestConsentInfoUpdate 侦听器,好像可能会出现一些错误。 在使用Google的admob进行注册时,我使用的是他们为其分配的发布者ID。这很奇怪,因为该代码实际上是从官方的Appodeal示例移植而来的。
要进一步测试该问题,如果运行命令 consentInformation.getConsentStatus(),我将始终得到: ConsentStatus.UNKNOWN ,因此该变量甚至无法检测用户决定启用或禁用个性化广告的当前状态。
那么,这是怎么回事?为什么我无法检测到这种简单的同意状态?代码中有什么问题吗?还是这里缺少什么?有什么想法吗?
为帮助确定问题,我包含了Logcat的内容。注意这一行: I / ConsentInformation:此请求是从测试设备发送的。 有关系吗?
04-02 23:11:55.037 8302-8302/? I/art: Not late-enabling -Xcheck:jni (already on)
04-02 23:11:55.112 8302-8302/education.languagepractice.languagepractice W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/education.languagepractice.languagepractice-1/split_lib_dependencies_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@education.languagepractice.languagepractice-1@split_lib_dependencies_apk.apk@classes.dex) because non-0 exit status
04-02 23:11:55.697 8302-8302/education.languagepractice.languagepractice W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/education.languagepractice.languagepractice-1/split_lib_slice_0_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@education.languagepractice.languagepractice-1@split_lib_slice_0_apk.apk@classes.dex) because non-0 exit status
04-02 23:11:55.713 8302-8302/education.languagepractice.languagepractice W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/education.languagepractice.languagepractice-1/split_lib_slice_1_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@education.languagepractice.languagepractice-1@split_lib_slice_1_apk.apk@classes.dex) because non-0 exit status
04-02 23:11:55.733 8302-8302/education.languagepractice.languagepractice W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/education.languagepractice.languagepractice-1/split_lib_slice_2_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@education.languagepractice.languagepractice-1@split_lib_slice_2_apk.apk@classes.dex) because non-0 exit status
04-02 23:11:55.745 8302-8302/education.languagepractice.languagepractice W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/education.languagepractice.languagepractice-1/split_lib_slice_3_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@education.languagepractice.languagepractice-1@split_lib_slice_3_apk.apk@classes.dex) because non-0 exit status
04-02 23:11:55.766 8302-8302/education.languagepractice.languagepractice W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/education.languagepractice.languagepractice-1/split_lib_slice_4_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@education.languagepractice.languagepractice-1@split_lib_slice_4_apk.apk@classes.dex) because non-0 exit status
04-02 23:11:55.777 8302-8302/education.languagepractice.languagepractice W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/education.languagepractice.languagepractice-1/split_lib_slice_5_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@education.languagepractice.languagepractice-1@split_lib_slice_5_apk.apk@classes.dex) because non-0 exit status
04-02 23:11:55.799 8302-8302/education.languagepractice.languagepractice W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/education.languagepractice.languagepractice-1/split_lib_slice_6_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@education.languagepractice.languagepractice-1@split_lib_slice_6_apk.apk@classes.dex) because non-0 exit status
04-02 23:11:55.811 8302-8302/education.languagepractice.languagepractice W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/education.languagepractice.languagepractice-1/split_lib_slice_7_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@education.languagepractice.languagepractice-1@split_lib_slice_7_apk.apk@classes.dex) because non-0 exit status
04-02 23:11:55.828 8302-8302/education.languagepractice.languagepractice W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/education.languagepractice.languagepractice-1/split_lib_slice_8_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@education.languagepractice.languagepractice-1@split_lib_slice_8_apk.apk@classes.dex) because non-0 exit status
04-02 23:11:55.841 8302-8302/education.languagepractice.languagepractice W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/education.languagepractice.languagepractice-1/split_lib_slice_9_apk.apk --oat-file=/data/dalvik-cache/x86/data@app@education.languagepractice.languagepractice-1@split_lib_slice_9_apk.apk@classes.dex) because non-0 exit status
04-02 23:11:55.880 8302-8302/education.languagepractice.languagepractice I/InstantRun: starting instant run server: is main process
04-02 23:11:56.001 8302-8345/education.languagepractice.languagepractice W/DynamiteModule: Local module descriptor class for com.google.android.gms.measurement.dynamite not found.
04-02 23:11:56.011 8302-8340/education.languagepractice.languagepractice I/DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:310
04-02 23:11:56.011 8302-8340/education.languagepractice.languagepractice I/DynamiteModule: Selected remote version of com.google.android.gms.ads.dynamite, version >= 310
04-02 23:11:56.013 8302-8340/education.languagepractice.languagepractice W/DynamiteModule: Dynamite loader version < 2, falling back to loadModule2
04-02 23:11:56.014 8302-8345/education.languagepractice.languagepractice I/DynamiteModule: Considering local module com.google.android.gms.measurement.dynamite:0 and remote module com.google.android.gms.measurement.dynamite:0
04-02 23:11:56.015 8302-8345/education.languagepractice.languagepractice W/Ads: Data collection startup failed. No data will be collected.
com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module found. Local version is 0 and remote version is 0.
at com.google.android.gms.dynamite.DynamiteModule.load(Unknown Source)
at com.google.android.gms.internal.measurement.zzea.zzg(Unknown Source)
at com.google.android.gms.internal.measurement.zzeb.zzgd(Unknown Source)
at com.google.android.gms.internal.measurement.zzea$zzb.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
04-02 23:11:56.015 8302-8345/education.languagepractice.languagepractice W/Ads: Failed to connect to measurement client.
04-02 23:11:56.035 8302-8340/education.languagepractice.languagepractice W/System: ClassLoader referenced unknown path: /data/data/com.google.android.gms/app_chimera/m/00000000/n/x86
04-02 23:11:56.067 8302-8302/education.languagepractice.languagepractice I/ConsentInformation: This request is sent from a test device.
04-02 23:11:56.079 8302-8347/education.languagepractice.languagepractice D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
04-02 23:11:56.116 8302-8347/education.languagepractice.languagepractice I/OpenGLRenderer: Initialized EGL, version 1.4
04-02 23:11:56.116 8302-8347/education.languagepractice.languagepractice W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
04-02 23:11:56.130 8302-8347/education.languagepractice.languagepractice D/EGL_emulation: eglCreateContext: 0xaf195200: maj 3 min 1 rcv 4
04-02 23:11:56.133 8302-8347/education.languagepractice.languagepractice D/EGL_emulation: eglMakeCurrent: 0xaf195200: ver 3 1 (tinfo 0xa21ff210)
04-02 23:11:56.133 8302-8347/education.languagepractice.languagepractice E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
04-02 23:11:56.133 8302-8347/education.languagepractice.languagepractice E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
04-02 23:11:56.133 8302-8347/education.languagepractice.languagepractice E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824
04-02 23:11:56.147 8302-8347/education.languagepractice.languagepractice D/EGL_emulation: eglMakeCurrent: 0xaf195200: ver 3 1 (tinfo 0xa21ff210)