로딩중입니다
Client Reward Integration : Unity Android
4/29/2016 5:20:46 PM

IGAW Reward Server Integration: Client Type

In case the internal server to receive callbacks from the IGAW reward server is difficult to set up, the additional client integration can be achieved to treat reward. 



AndroidManifest.xml

To treat reward callbacks through the client, the reward server integration system should be edited.

Set the reward server integration method within the <application></application> tags as client as below.

<meta-data android:name="igaworks_reward_server_type" android:value="client"/>



Event Listener API

Register event listener which receives reward pay information from Android plugin library and OfferWall action event.

Call IgaworksUnityPluginAOS.Common.setClientRewardEventListener and IgaworksUnityPluginAOS.Adpopcorn.setAdpopcornOfferwallEventListener.

void Awake() {
		IgaworksUnityPluginAOS.InitPlugin ();
		IgaworksUnityPluginAOS.Common.startApplication ();
                
		//Add event listener to receive reward giving information.
		IgaworksUnityPluginAOS.Common.setClientRewardEventListener ();
		//Add event listener to receive OfferWall action event.
		IgaworksUnityPluginAOS.Adpopcorn.setAdpopcornOfferwallEventListener ();
	}



Register & Implement Reward Delegate

Register and implement delegate to receive reward information from IGAW reward server.


Delegate Detailed Description

1. OnGetRewardInfo(string campaignkey, string campaignname, string quantity, string cv, string rewardkey)

Unresolved reward information in the IGAW reward server is being delivered.

  1. campaignkey : Key for the user completed campaign.
  2. campaignname : Name for the user completed campaign.
  3. quantity : Virtual currency amount given to the user.
  4. cv : API sent to the IGAW server notifying that reward distribution has been completed. 
  5. rewardkey : API sent to the IGAW server notifying that reward distribution has been completed. 

Rewards will be given to users based on the information specified from no. 1 through 3 listed above. The didGiveRewardItem api including no. 4 and 5 will then be called up to notify the IGAW reward server.


2. OnDidGiveRewardItemRequestResult (bool isSuccess, string rewardkey)

The results of the callup didGiveRewardItem API above will be delivered. Use the delivered rewardKey for duplicate reward prevention and other functions.

void Awake() {
		// Add delegate
		IgaworksUnityPluginAOS.OnGetRewardInfo = mOnGetRewardInfo;
		IgaworksUnityPluginAOS.OnDidGiveRewardItemRequestResult = mOnDidGiveRewardItemRequestResult;   
}

// Materialize delegate
void mOnGetRewardInfo(string campaignkey, string campaignname, string quantity, string cv, string rewardkey){    
		string ck = campaignkey;
		string cn = campaignname;
		string qt = quantity;
		// Give reward to user with above information.
		// {Give Reward}
 
		// Call didGiveRewardItem API to send reward giving call to IGAW reward server.
		IgaworksUnityPluginAOS.Common.didGiveRewardItem (cv, rewardkey);
}
void mOnDidGiveRewardItemRequestResult (bool isSuccess, string rewardkey) {
                // didGiveRewardItem formula's result will be returned.
		// It will prevent to give reward multiple times for same rewardkey,
	}



Register & Implement OfferWall Delegate

Register and implement delegate regards to OfferWall closing action to request reward payment information inquiry from IGAW reward server.


1. Register delegate

Register delegate for OfferWall close action.

IgaworksUnityPluginAOS.OnClosedOfferwallPage = mOnClosedOfferwallPage;


2. Implement delegate

Implement delegate for OfferWall close action. Request the reward payment information inquiry within delegate.

void mOnClosedOfferwallPage() {
	IgaworksUnityPluginAOS.Common.getClientPendingRewardItems();
}



Request Reward Information

Reward event listener is called up when the OfferWall begins or ends. In case there is a set of reward information that needs to be treated in the IGAW reward server, that information is transmitted, too.

If you want to view the reward information for this case, you can call up the API below and view it through the IGAW reward server.

IgaworksUnityPluginAOS.Common.getClientPendingRewardItems();



Integration Test

Participate in and complete a test ad from the test device set in [Manage OfferWall > QA & Optimize > Set Test Device] in the adPOPcorn admin page. If it can be verified that the rewards have been distributed from that app, the integration is in working order.