Android,即使用户不同意或用户关闭表单,UMP 也始终返回“OBTAINED”。所以很难用它做任何事情。我想知道用户是否不同意,在这种情况下关闭应用程序。然后下次打开应用程序时,应该立即显示表单。然而,另一个问题是,当用户在表单中选择内容并批准同意时,下次再次打开表单时,设置将被重置(就像表单从未保存过一样)。另一个问题是,用户几乎不可能选择正确的内容来获取广告,并且在大多数情况下,用户将获得一个没有任何广告的免费应用程序(因为 OBTAINED 状态并不能说明用户是否同意)。另外,我无法获取用户选择的内容(我真的需要查看共享首选项才能获取该信息吗?总体而言,这个 UMP 似乎工作得很奇怪,或者也许我实现了错误?也许很快就会发布任何改进?使用实现'com.google.android.ump:user-messaging-platform:2.1.0'
另外,如果用户已经同意,并且 Admob 设置从我的应用程序的个人广告更改为非个人广告,那么用户仍然会收到个人广告。
这是代码:
ConsentRequestParameters params = new ConsentRequestParameters
.Builder()
.setTagForUnderAgeOfConsent(false)
.build();
ConsentInformation consentInformation;
consentInformation = UserMessagingPlatform.getConsentInformation(this.getApplicationContext());
consentInformation.requestConsentInfoUpdate(
(Activity) this,
params,
new ConsentInformation.OnConsentInfoUpdateSuccessListener() {
@Override
public void onConsentInfoUpdateSuccess() {
// The consent information state was updated.
// You are now ready to check if a form is available.
if (consentInformation.isConsentFormAvailable()) {
// Loads a consent form. Must be called on the main thread.
UserMessagingPlatform.loadConsentForm(
MyActivity.this.getApplicationContext(),
new UserMessagingPlatform.OnConsentFormLoadSuccessListener() {
@Override
public void onConsentFormLoadSuccess(ConsentForm consentForm) { …Run Code Online (Sandbox Code Playgroud)