Exemplo n.º 1
0
 void OnApplicationPause(bool paused)
 {
     if (!paused)
     {
         PokktManager.GetPendingCoins();
         PokktManager.CheckOfferWallCampaign();
     }
 }
Exemplo n.º 2
0
 public void OnClickWatchAds()
 {
     if (GameDataManager.PlayUnityVideoAd())
     {
         StartCoroutine(ShowingAds());
     }
     else
     {
         PokktManager.CacheVideoCampaign();
     }
 }
 public void PlayVideo(bool incent)
 {
     if (incent)
     {
         PokktManager.GetVideo(pokktConfig);
     }
     else
     {
         PokktManager.GetVideoNonIncent(pokktConfig);
     }
 }
Exemplo n.º 4
0
    void Awake()
    {
        // You will need PokktConfig at different method calls
        // it is single place fro all sdk related info
        pokktConfig = new PokktConfig();

        // set pokkt params
        pokktConfig.setSecurityKey("iJ02lJss0M");
        pokktConfig.setApplicationId("a2717a45b835b5e9f50284a38d62a74e");
        pokktConfig.setIntegrationType(PokktIntegrationType.INTEGRATION_TYPE_ALL);
        pokktConfig.setAutoCacheVideo(false);

        PokktManager.initPokkt(pokktConfig);

        // this will be a unique id per user from developer side
        // developer is free to choose any String data point.
        pokktConfig.setThirdPartyUserId("123456");

        // handle pokkt offerwall events
        PokktManager.Dispathcer.CoinResponseEvent += (string message) =>
        {
            _totalPointsEarned += int.Parse(message);

            PointsEarned.text  = "Points Earned: " + _totalPointsEarned.ToString();
            StatusMessage.text = "Points earned from last operation: " + message;
        };

        PokktManager.Dispathcer.CoinResponseWithTransIdEvent += (string message) =>
        {
            string[] items   = message.Split(new char[] { ',', ' ' }, System.StringSplitOptions.RemoveEmptyEntries);
            string   points  = items[0];
            string   transId = items[1];

            _totalPointsEarned += int.Parse(points);

            PointsEarned.text  = "Points Earned: " + _totalPointsEarned.ToString();
            StatusMessage.text = "Points earned from transaction id: " + transId + ", earned points: " + points;
        };

        PokktManager.Dispathcer.CoinResponseFailedEvent += (string message) =>
        {
            StatusMessage.text = message;
        };

        PokktManager.Dispathcer.CampaignAvailabilityEvent += (string message) =>
        {
            StatusMessage.text = message;
        };

        PokktManager.Dispathcer.OfferwallClosedEvent += (string message) =>
        {
            StatusMessage.text = message;
        };
    }
Exemplo n.º 5
0
    private void OnDownloadCompleted(string message)
    {
        Debug.LogError("video download complete");

        PokktManager.GetVideo(pokktConfig);
    }
Exemplo n.º 6
0
    public override void OnShow()
    {
        bool bRated = false;

        if (PlayerPrefs.HasKey(PlayerPrefHandler.keyRateUs) == false)
        {
            PlayerPrefs.SetInt(PlayerPrefHandler.keyRateUs, 0);
        }
        else
        {
            if (PlayerPrefs.GetInt(PlayerPrefHandler.keyRateUs) == 1)
            {
                bRated = true;
            }
        }

        if (bRated)
        {
            buttonRateUs.gameObject.SetActive(false);
        }
        else
        {
            buttonRateUs.gameObject.SetActive(true);
        }

        if (!bPokktInitialized)
        {
            bPokktInitialized = true;
            pokktConfig       = new PokktConfig();
            pokktConfig.setSecurityKey("0c264c7465abbe0bf7327b59cd86bffd");
            pokktConfig.setApplicationId("b9ae5052bc5209c0b9fc026d5598eba5");
            pokktConfig.setIntegrationType(PokktIntegrationType.INTEGRATION_TYPE_ALL);
            pokktConfig.setAutoCacheVideo(Storage.getAutoCaching());

            PokktManager.initPokkt(pokktConfig);
            pokktConfig.setThirdPartyUserId("123456");

            //StartCacheButton.gameObject.SetActive(!Storage.getAutoCaching());

            // set default skip time
            pokktConfig.setDefaultSkipTime(10);

            pokktConfig.setScreenName("sample_screen");

            // handle pokkt video ad events
            PokktManager.Dispathcer.VideoClosedEvent += (string message) =>
            {
                //dialogBox.Show ("Info", message, false, "", this.gameObject);
                //GiveCoinToUserAfterWatchingAds();
            };

            PokktManager.Dispathcer.VideoSkippedEvent += (string message) =>
            {
                //dialogBox.Show ("Info", message, false, "", this.gameObject);
                dialogBox.Show("Info", "Skipping ads will not give you any GemuGold.", false, "", this.gameObject);
            };

            PokktManager.Dispathcer.VideoCompletedEvent += (string message) =>
            {
                //dialogBox.Show ("Info", message, false, "", this.gameObject);
                //GiveCoinToUserAfterWatchingAds();
            };

            PokktManager.Dispathcer.VideoGratifiedEvent += (string message) =>
            {
                //dialogBox.Show ("Info", message, false, "", this.gameObject);
                //_totalPointsEarned += float.Parse(message);

                //PointsEarned.text = "Points Earned: " + _totalPointsEarned.ToString();
                //StatusMessage.text = "Points earned from last video: " + message;

                GiveCoinToUserAfterWatchingAds();
            };

            PokktManager.Dispathcer.VideoDisplayedEvent += (string message) =>
            {
                //dialogBox.Show ("Info", message, false, "", this.gameObject);
                //StatusMessage.text = message;
            };

            PokktManager.Dispathcer.DownloadCompletedEvent += OnDownloadCompleted;

            PokktManager.Dispathcer.DownloadFailedEvent += (string message) =>
            {
                dialogBox.Show("Info", message, false, "", this.gameObject);
                //StatusMessage.text = message;
            };

            // if video is available then enable the buttons
            if (PokktManager.IsVideoAvailable())
            {
                float vc = PokktManager.GetVideoVc();
                OnDownloadCompleted(vc.ToString());
            }
        }
    }
    void Awake()
    {
        // You will need PokktConfig at different method calls
        // it is single place fro all sdk related info
        pokktConfig = new PokktConfig();

        // set pokkt params
        pokktConfig.setSecurityKey("iJ02lJss0M");
        pokktConfig.setApplicationId("a2717a45b835b5e9f50284a38d62a74e");
        pokktConfig.setIntegrationType(PokktIntegrationType.INTEGRATION_TYPE_ALL);
        pokktConfig.setAutoCacheVideo(Storage.getAutoCaching());

        // this will be a unique id per user from developer side
        // developer is free to choose any String data point.
        pokktConfig.setThirdPartyUserId("123456");

        // enable 'Start Caching' button in case of manual caching
        StartCacheButton.gameObject.SetActive(!Storage.getAutoCaching());

        // set default skip time
        pokktConfig.setDefaultSkipTime(10);

        pokktConfig.setScreenName("sample_screen");

        // handle pokkt video ad events
        PokktManager.Dispathcer.VideoClosedEvent += (string message) =>
        {
            StatusMessage.text = message;
        };

        PokktManager.Dispathcer.VideoSkippedEvent += (string message) =>
        {
            StatusMessage.text = message;
        };

        PokktManager.Dispathcer.VideoCompletedEvent += (string message) =>
        {
            StatusMessage.text = message;
        };

        PokktManager.Dispathcer.VideoGratifiedEvent += (string message) =>
        {
            _totalPointsEarned += float.Parse(message);

            PointsEarned.text  = "Points Earned: " + _totalPointsEarned.ToString();
            StatusMessage.text = "Points earned from last video: " + message;
        };

        PokktManager.Dispathcer.VideoDisplayedEvent += (string message) =>
        {
            StatusMessage.text = message;
        };

        PokktManager.Dispathcer.DownloadCompletedEvent += OnDownloadCompleted;

        PokktManager.Dispathcer.DownloadFailedEvent += (string message) =>
        {
            StatusMessage.text = message;
        };

        // it is mandatory to call init.
        PokktManager.initPokkt(pokktConfig);

        // if video is available then enable the buttons
        if (PokktManager.IsVideoAvailable())
        {
            float vc = PokktManager.GetVideoVc();
            OnDownloadCompleted(vc.ToString());
        }
    }
 public void StartCaching()
 {
     PokktManager.CacheVideoCampaign();
 }
Exemplo n.º 9
0
 void Awake()
 {
     // set debug
     PokktManager.SetDebug(true);
 }
Exemplo n.º 10
0
 public void GetOfferwallFixed()
 {
     PokktManager.GetCoins(pokktConfig);
 }
Exemplo n.º 11
0
 public void GetOfferwallAny()
 {
     pokktConfig.setOfferWallAssetValue("");
     PokktManager.GetCoins(pokktConfig);
 }
Exemplo n.º 12
0
 public void GetPendingCoins()
 {
     PokktManager.GetPendingCoins();
 }
Exemplo n.º 13
0
        //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();
            //			};
        }
Exemplo n.º 14
0
 protected override void OnResume()
 {
     base.OnResume();
     PokktManager.resumeBanner(editTextScreenName.Text);
 }