如果用户按下按钮,我试图停止协程。但是,当我这样做时:
GlobalScope.launch(Dispatchers.Main) {
//code
}
button.setonclicklistener(){
GlobalScope.cancel()
}
Run Code Online (Sandbox Code Playgroud)
应用程序崩溃。我怎样才能解决这个问题?
我对 UMP SDK 的实现有很多困惑。除了谷歌之外,我没有找到太多信息或完整教程。我正在关注这个和这个,但无法理解以下问题:
MobileAds.initialize()
征得同意后需要打电话吗?如果是这样,那么它应该在哪里调用?获得同意后可能会调用:
public void onConsentFormLoadSuccess(ConsentForm consentForm) {
if(consentInformation.getConsentStatus() == ConsentInformation.ConsentStatus.OBTAINED) {
}
}
Run Code Online (Sandbox Code Playgroud)
我如何检查用户是否来自欧洲经济区?我想根据用户位置请求同意或初始化移动广告。在Consent SDK 中,有一个 method isRequestLocationInEeaOrUnknown()
,但此 SDK 已弃用。我在 UMP SDK 中没有找到类似的东西。一种方法可能是始终requestConsentInfoUpdate
调用isConsentFormAvailable
inside onConsentInfoUpdateSuccess
。如果用户不是来自 EEA,则此方法返回 false。
我总是得到同意类型consentInformation.getConsentType()
0 或未知。我尝试过不同的组合,但总是 0。
是否需要将同意信息转发给 AdMob SDK 或 SDK 会处理。
关于调解,我需要同意信息,但不知道如何获取。从文档:The UMP SDK writes consent status information to local storage
在 AdMob -> 欧盟用户同意中,我的中介合作伙伴之一未包含在Commonly used set of ad technology providers
. 如果我使用Custom …
android admob mobile-ad-mediation gdprconsentform user-messaging-platform
如果我的应用程序中有一个带有注释的类,@ActivityRetained
那么能够访问将被适当取消的协程作用域是有意义的。它类似于viewModelScope
a 中的ViewModel
。
这是可以做的事情还是仍然需要实施的事情?
我尝试将 Google Consent 与用户消息传递平台结合使用,以在 Android 应用同意表中显示。我遵循此文档https://developers.google.com/admob/ump/android/quick-start。
我收到此错误:
onConsentInfoUpdateFailure: Publisher misconfiguration: Failed to read publisher's account configuration; please check your configured app ID. Received app ID: `ca-app-pub-XXXXXXXXXXXXXXXX~XXXXXXXXXX`.
Run Code Online (Sandbox Code Playgroud)
我的代码:
ConsentRequestParameters params;
if (testingGDPR) {
ConsentDebugSettings debugSettings = new ConsentDebugSettings.Builder(this)
.setDebugGeography(ConsentDebugSettings.DebugGeography.DEBUG_GEOGRAPHY_EEA)
.addTestDeviceHashedId(getString(R.string.ADMOB_REAL_DEVICE_HASH_ID_FOR_TESTING))
.build();
params = new ConsentRequestParameters.Builder().setConsentDebugSettings(debugSettings).build();
} else {
params = new ConsentRequestParameters.Builder().build();
}
consentInformation = UserMessagingPlatform.getConsentInformation(this);
if (testingGDPR) {
consentInformation.reset();
}
consentInformation.requestConsentInfoUpdate(
this,
params,
new ConsentInformation.OnConsentInfoUpdateSuccessListener() {
@Override
public void onConsentInfoUpdateSuccess() {
if (consentInformation.isConsentFormAvailable() && consentInformation.getConsentStatus() == ConsentInformation.ConsentStatus.REQUIRED) { …
Run Code Online (Sandbox Code Playgroud) 据我了解,GDPR 需要同意才能撤销。
我只找到了 ConsentInformation.reset() 方法,但该方法特别提到它仅用于调试目的。
撤销同意以便再次显示同意对话框的正确方法是什么?
我是Android新手.我试图将FB登录与我的Android应用程序集成.我已经按照developers.facebook.com上的所有说明进行了此集成.但是,当我尝试运行我的应用程序时,它会在启动时崩溃.
请注意,我的AndroidManifest.xml中已经有Facebook App ID,元数据标签,android活动标签.
以下是布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:background="@drawable/background">
<RelativeLayout android:id="@+id/container" android:layout_width="match_parent"
android:paddingBottom="20dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="20dp"
android:layout_height="match_parent"
android:background="#85000000">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/topSocialLoginLayout"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp">
<com.facebook.login.widget.LoginButton
android:id="@+id/btnFacebook"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_weight="5"/>
<com.google.android.gms.common.SignInButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:id="@+id/btnGoogle"
android:layout_weight="5" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:paddingLeft="20dp"
android:id="@+id/relLayoutMainLogin"
android:layout_below="@id/topSocialLoginLayout">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:inputType="textEmailAddress"
android:layout_alignParentTop="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:hint="@string/email"
android:textColor="#fd9a22"
android:textCursorDrawable="@drawable/cursor_color"
android:textColorHint="#ffffff"
android:id="@+id/txtUser"
android:background="@drawable/edit_text"
android:drawableLeft="@drawable/dr_email"
android:drawablePadding="10dp"
android:paddingLeft="-3dp"
android:singleLine="true" />
<EditText
android:layout_width="match_parent"
android:inputType="textPassword"
android:layout_height="wrap_content"
android:layout_below="@id/txtUser"
android:id="@+id/txtPwd"
android:hint="@string/pwd"
android:textColor="#fd9a22"
android:textCursorDrawable="@drawable/cursor_color" …
Run Code Online (Sandbox Code Playgroud) android android-layout facebook-android-sdk facebook-login android-activity
我应该在 HTML4 和 HTML5 中使用&
还是足够了href=""
?&
大多数浏览器都没有问题,但是应该如何完成呢?
<a href="?param1=1¶m2=2">Call()</a>
Run Code Online (Sandbox Code Playgroud)
或者
<a href="?param1=1&param2=2">Call()</a>
Run Code Online (Sandbox Code Playgroud) 我从Android Studio创建了一个示例项目.虽然创建第一次它要求移动应用程序,我也检查了电视项目.它在同一个项目中创建了两个模块,名称为mobile和tv,两个项目分别包含res,main,values文件夹.当我尝试运行项目时,我可以运行任何一个,它为两者创建单独的apk.是否有可能创建一个apk并在电视和移动设备上运行?
所以我开始使用 kotlin 课程观看 android 开发。解释的人使用“R”而没有解释任何有关它的内容。我尝试搜索文档,但找不到任何内容。
这是一个示例代码:
when(...) { ...
R.id.btn9 -> btnID=9 // where btn9 is an id of a button in the UI
}
Run Code Online (Sandbox Code Playgroud)