iosactionscript-3airtapjoy

Using Tapjoy Adobe AIR sdk


I wish to use Tapjoy in my Adobe AIR iOS project. However I have no clue how to integrate it in my app. The documentation provided by them is very poor and difficult to understand. Following is what I have done till now :

1 . Added required ANE and swc to the project. 2. Added following imports in my code

import com.tapjoy.extensions.ITapjoyConnectRequestCallback;
import com.tapjoy.extensions.TapjoyAIR;
import com.tapjoy.extensions.TapjoyEvent;
import com.tapjoy.extensions.TapjoyMacAddressOption;
import com.tapjoy.extensions.TapjoyPointsEvent;
import com.tapjoy.extensions.TapjoyTransition;
import com.tapjoy.extensions.TapjoyViewChangedEvent;
import com.tapjoy.extensions.TJEvent;
import com.tapjoy.extensions.ITJEventCallback;
import com.tapjoy.extensions.TJEventRequest;
  1. Inside Constructor checked for the Platform

    if (Capabilities.manufacturer.search("iOS") != -1)
        {
            // iOS platform
            // If you are not using Tapjoy Managed currency, you would set      your own user ID here.
            //  connectFlags["TJC_OPTION_USER_ID"] ="A_UNIQUE_USER_ID";
    
            // You can also set your event segmentation parameters here.
            //  var segmentationParams:Object = { "iap": true }
            //  connectFlags["TJC_OPTION_SEGMENTATION_PARAMS"] = segmentationParams;
    
            // Enable logging
            connectFlags["TJC_OPTION_ENABLE_LOGGING"] = true;
    
            // Pass option to toggle the collection of MAC address
            connectFlags["TJC_OPTION_COLLECT_MAC_ADDRESS"] = TapjoyMacAddressOption.MacAddressOptionOffWithVersionCheck;
    
            TapjoyAIR.requestTapjoyConnect("13b0ae6a-8516-4405-9dcf-fe4e526486b2", "XHdOwPa8de7p4aseeYP0", connectFlags); 
            //trace("" + connector);
        }
        else
        {
            // Android platform
    
            // If you are not using Tapjoy Managed currency, you would set your own user ID here.
            //  connectFlags["user_id"] ="A_UNIQUE_USER_ID";
    
            // You can also set your event segmentation parameters here.
            //  var segmentationParams:Object = { "iap": true }
            //  connectFlags["segmentation_params"] = segmentationParams;
    
            // Enable logging
            connectFlags["enable_logging"] = true;
    
            TapjoyAIR.requestTapjoyConnect("bba49f11-b87f-4c0f-9632-21aa810dd6f1", "yiQIURFEeKm0zbOggubu", connectFlags);
            //isAndroid = true;
        }
    
  2. Next I need to show theOfferWall if connection to Tapjoy has succeded. How do I do that?


Solution

  • Add listeners to the object (as defined in docs):

    You must call requestTapjoyConnect before any other Tapjoy methods, ex:

    TapjoyAIR.requestTapjoyConnect("YOUR_TAPJOY_APP_ID_HERE", "YOUR_TAPJOY_SECRET_KEY_HERE");
    
    extension = TapjoyAIR.getTapjoyConnectInstance();
    

    Register an event listener for all the events you want to capture, ex:

    extension.addEventListener(type, function, …);
    

    You can find all Tapjoy AIR events defined in TapjoyEvent, TapjoyDisplayAdEvent and TapjoyPointsEvent.