Can't connect Tapjoy SDK

31 Views Asked by At

I'm working on Unity game, android build target. I face to issue when integrate SDK to my game. After follow https://dev.tapjoy.com/en/unity-plugin/Quickstart document Here is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TapjoyUnity;

public class TJSCript : MonoBehaviour    
{
    string sdkKey = "/////////////my code///////"; 
    public Text debugText;
    // Start is called before the first frame update
    void Start()
    {
        
            Tapjoy.OnConnectSuccess += HandleConnectSuccess;
            Tapjoy.OnConnectWarning += HandleConnectWarning;
            Tapjoy.OnConnectFailed += HandleConnectFailed;

    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void ConnectSDK(){
        if (!Tapjoy.IsConnected) {
            debugText.text = "Connecting SDK";
            Debug.Log(sdkKey);
            Tapjoy.Connect(sdkKey);
            Tapjoy.Connect();
        } else{
            
            Debug.Log("SDK Connected");
        }
    }

     public void RequestOfferwall()
    {
        TJPlacement placement = TJPlacement.CreatePlacement("AppLaunch");
        placement.RequestContent();
        if (placement.IsContentReady()) {
        placement.ShowContent();
        }
        
    }


public void HandleConnectSuccess() {
    Debug.Log ("Connect Success");
    debugText.text = "Connect Success";
    // Now that we are connected we can start preloading our placements
    TJPlacement p = TJPlacement.CreatePlacement("AppLaunch");
    p.RequestContent();
}

void HandleConnectWarning(int code, string message)
{
    debugText.text = "Connect Warning " + message;
}


public void HandleConnectFailed(int code, string message){
    debugText.text = "Connect Failed " + message;

}

}

C#: Can not send placement becuause Tapjoy has not successfully connected

I'm tried to test Tapjoy example code but it's still same, can't be connected.

1

There are 1 best solutions below

0
Marios L On

If you can't connect, make sure your SDK key is properly pasted from the tapjoy portal. You should also check your internet connection. It might help to try and enable auto-connect on the tapjoy settings (Window > Tapjoy) and make sure you paste the sdk key in there as well.