Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using com.amazon.mas.cpt.ads;
- public class AmazonAdsTest : MonoBehaviour {
- IAmazonMobileAds mobileAds;
- Ad mobileAd;
- void Start () {
- mobileAds = AmazonMobileAdsImpl.Instance;
- }
- void OnGUI () {
- if (GUILayout.Button("Init", GUILayout.Width(200f), GUILayout.Height(100f))) {
- ShouldEnable enable = new ShouldEnable();
- enable.BooleanValue = true;
- mobileAds.EnableLogging(enable);
- mobileAds.EnableTesting(enable);
- mobileAds.EnableGeoLocation(enable);
- ApplicationKey key = new ApplicationKey();
- key.StringValue = "sample-app-v1_pub-2";
- mobileAds.SetApplicationKey(key);
- }
- if (GUILayout.Button("CreateInterstitialAd", GUILayout.Width(200f), GUILayout.Height(100f))) {
- mobileAd = mobileAds.CreateInterstitialAd();
- // Get return values
- string adType = mobileAd.AdType.ToString();
- long identifier = mobileAd.Identifier;
- Debug.Log( adType + " " + identifier );
- }
- if (GUILayout.Button("LoadInterstitialAd", GUILayout.Width(200f), GUILayout.Height(100f))) {
- LoadingStarted response = mobileAds.LoadInterstitialAd();
- bool loadingStarted = response.BooleanValue;
- Debug.Log("loadingStarted: " + loadingStarted);
- }
- if (GUILayout.Button("Play", GUILayout.Width(200f), GUILayout.Height(100f))) {
- AdShown response = mobileAds.ShowInterstitialAd();
- bool adShown = response.BooleanValue;
- Debug.Log("adShown: " + adShown);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement