Android Consent SDK无法将模拟器识别为API 30上的测试设备

问题描述

我已经获得GDPR同意的Android同意SDK的工作版本。在物理和仿真设备上运行良好。对于仿真设备,SDK应该识别出它是仿真器,而不一定带有设备ID的显式addTestDevice()。但是,似乎使用API​​ 30无法识别仿真设备。解决方法是,Logcat标识我明确传递给addTestDevice()的仿真器设备ID。下面是我的代码,就像我说的那样,它最适合API29。API30不能隐式识别模拟器。我在API 30上同时尝试了Pixel 3和Pixel XL。我想知道是否还有其他人看到过此消息,或者我应该在API 30中了解一些新知识。谢谢!

  fun initializeGDPR(responseCallBack: (status:GDPRConsentResponse) -> Unit) {

        val consentInformation = ConsentInformation.getInstance(context)

        if (ENABLE_TEST_EEA_CONSENT)
            enableEEATestDevices(consentInformation)

        consentInformation.requestConsentInfoUpdate(arrayOf(context.getString(R.string.admob_publisher_id)),object : ConsentInfoUpdateListener {
            override fun onConsentInfoUpdated(consentStatus: ConsentStatus) {

                Log.d("ConsentHelper","initializeGDPR:onConsentInfoUpdated: $consentStatus")

                //Is user if European Union or request location is Unknown
                if(consentInformation.isRequestLocationInEeaOrUnknown) {
                    Log.d("ConsentHelper","initializeGDPR:isRequestLocationInEeaOrUnknown: true");

                    //  If the returned ConsentStatus is PERSONALIZED or NON_PERSONALIZED,the user has already provided consent. Call back to initial calling routine to habdle
                    //  If the returned ConsentStatus is UNKNOWN,load form to get consent
                    when (consentStatus) {
                        ConsentStatus.UNKNOWN -> displayGDPRConsentForm(responseCallBack)
                        ConsentStatus.PERSONALIZED -> {
                            consentResponse = GDPRConsentResponse.SHOW_PERSONAL
                            responseCallBack(consentResponse)
                        }
                        ConsentStatus.NON_PERSONALIZED ->  {
                            consentResponse = GDPRConsentResponse.SHOW_NON_PERSONAL
                            responseCallBack(consentResponse)
                        }
                    }

                } else {
                    Log.d("ConsentHelper","initializeGDPR:isRequestLocationInEeaOrUnknown: false")
                    isEEA = false
                    consentResponse = GDPRConsentResponse.UNKNOWN
                    responseCallBack(consentResponse)
                }
            }

            override fun onFailedToUpdateConsentInfo(errorDescription: String) {
                Log.d("ConsentHelper","initializeGDPR:onFailedToUpdateConsentInfo: $errorDescription");
                errorString = errorDescription
                consentResponse = GDPRConsentResponse.UNKNOWN
                responseCallBack(consentResponse)
            }
        })
    }

private fun enableEEATestDevices(consentInformation:ConsentInformation) {
    consentInformation.debugGeography = DebugGeography.DEBUG_GEOGRAPHY_EEA
    consentInformation.addTestDevice(CONSENT_TEST_DEVICES_1)
    consentInformation.addTestDevice(CONSENT_TEST_DEVICES_2)
    consentInformation.addTestDevice(CONSENT_TEST_DEVICES_3)
    consentInformation.addTestDevice(CONSENT_TEST_DEVICES_4)
    consentInformation.addTestDevice(CONSENT_TEST_DEVICES_5)
    consentInformation.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...