Пример #1
0
 void Awake()
 {
     // set debug
     PokktManager.SetDebug(true);
 }
        //button_pokkt_init, button_no_rewarded, button_rewarded_ad, button_banner, button_offerwall, button_export_log;
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            PokktManager.SetNativeExtentions(new AndroidExtension(this));
            PokktManager.SetDebug(true);
            //global::Xamarin.Forms.Forms.Init (this, bundle);

            //LoadApplication (new App ());

            SetContentView(Resource.Layout.main_screen_layout);

            // TODO: find a proper place for the following
            //PokktExtension.PokktManager.SetNativeExtentions(new AndroidExtension());

            String versionName = "v";

            try
            {
                versionName += PokktManager.GetPokktSDKVersion();
                Log.Debug(TAG, "Version No: " + versionName);
            }
            catch (Exception e)
            {
                Log.Debug(TAG, e.Message);
            }
            initUI();
            txtVersionName.Text = versionName;

            // Pokkt init
            PokktManager.Dispatcher.PokktInitialisedEvent += onPokktInitialised;
            PokktManager.Dispatcher.BannerLoadedEvent     += onBannerLoaded;
            PokktManager.Dispatcher.BannerLoadFailedEvent += onBannerLoadFailed;
            buttonPokktInit.Click += delegate
            {
                buttonPokktInit.Text = "Initializing";
                PokktConfig config = new PokktConfig();
                config.SecurityKey = "ae501f1003b0dc927dea807498ceaf3c";
                // Chikkey 81f2f0b8e67752ddd552f9b9e2c678f3
                // Suraj Test App ae501f1003b0dc927dea807498ceaf3c
                config.ApplicationId = "954b975f9c753bcb8fca42624d78139a";
                // Chikkey 0f666bc5d176ce734443a4fe00183d63
                // Suraj Test App 954b975f9c753bcb8fca42624d78139a
                PokktManager.InitPokkt(config);
            };

            //Non-Rewarded Ad
            buttonNoRewarded.Click += delegate
            {
                if (editTextScreenName.Text.Length > 0)
                {
                    Intent intent = new Intent(this, typeof(VideoActivity));
                    intent.PutExtra("isRewarded", false);
                    intent.PutExtra("screenName", editTextScreenName.Text.ToString().Trim());
                    StartActivity(intent);
                }
                else
                {
                    Toast.MakeText(this, "screen name cannot be empty", ToastLength.Long).Show();
                }
            };
            //Rewarded Ad
            buttonRewardedAd.Click += delegate
            {
                if (editTextScreenName.Text.Length > 0)
                {
                    Intent intent = new Intent(this, typeof(VideoActivity));
                    intent.PutExtra("isRewarded", true);
                    intent.PutExtra("screenName", editTextScreenName.Text.ToString().Trim());
                    StartActivity(intent);
                }
                else
                {
                    Toast.MakeText(this, "screen name cannot be empty", ToastLength.Long).Show();
                }
            };

            // Pokkt banner
            buttonBanner.Click += delegate
            {
                PokktManager.LoadBanner(editTextScreenName.Text.ToString().Trim(), (int)BannerPosition.TopCenter);
                // PokktManager.BannerAutoRefresh(false);
            };
            //Offerwall
            buttonOfferwall.Click += delegate
            {
                StartActivity(new Intent(this, typeof(OfferwallActivity)));
            };

            // Export Log

            buttonExportLog.Click += delegate
            {
                PokktManager.ExportLog();
            };


            //			FindViewById<Button> (Resource.Id.button_export_log).Click += delegate
            //			{
            //				PokktManager.ExportLog();
            //			};
        }