-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathRequestConfigurationSnippets.cs
More file actions
85 lines (76 loc) · 2.83 KB
/
Copy pathRequestConfigurationSnippets.cs
File metadata and controls
85 lines (76 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// Copyright 2026 Google LLC
using UnityEngine;
using GoogleMobileAds.Api;
using System.Collections.Generic;
namespace GoogleMobileAds.Snippets
{
/// <summary>
/// Code snippets used for the developer guides.
/// </summary>
internal class RequestConfigurationSnippets
{
// Replace with your own test device ID.
private const string TEST_DEVICE_ID = "2077ef9a63d2b398840261c8221a0c9b";
private void SetTestDeviceIds()
{
// [START set_test_device_ids]
List<string> testDeviceIds = new List<string>();
testDeviceIds.Add(TEST_DEVICE_ID);
RequestConfiguration requestConfiguration = new RequestConfiguration
{
TestDeviceIds = testDeviceIds
};
// [END set_test_device_ids]
// [START set_request_configuration]
MobileAds.SetRequestConfiguration(requestConfiguration);
// [END set_request_configuration]
}
private void SetChildAgeTreatment()
{
// [START set_child_age_treatment]
RequestConfiguration requestConfiguration = new RequestConfiguration
{
AgeRestrictedTreatment = AgeRestrictedTreatment.Child
};
MobileAds.SetRequestConfiguration(requestConfiguration);
// [END set_child_age_treatment]
}
private void SetChildDirectedTreatment()
{
// [START set_child_directed_treatment]
RequestConfiguration requestConfiguration = new RequestConfiguration
{
TagForChildDirectedTreatment = TagForChildDirectedTreatment.True
};
MobileAds.SetRequestConfiguration(requestConfiguration);
// [END set_child_directed_treatment]
}
private void SetUnderAgeOfConsent()
{
// [START set_under_age_of_consent]
RequestConfiguration requestConfiguration = new RequestConfiguration
{
TagForUnderAgeOfConsent = TagForUnderAgeOfConsent.True
};
MobileAds.SetRequestConfiguration(requestConfiguration);
// [END set_under_age_of_consent]
}
private void SetMaxAdContentRating()
{
// [START set_max_ad_content_rating]
RequestConfiguration requestConfiguration = new RequestConfiguration
{
MaxAdContentRating = MaxAdContentRating.G
};
MobileAds.SetRequestConfiguration(requestConfiguration);
// [END set_max_ad_content_rating]
}
private void AddNetworkExtras()
{
// [START add_network_extras]
var adRequest = new AdRequest();
adRequest.Extras.Add("collapsible", "bottom");
// [END add_network_extras]
}
}
}