question

leeyencuhn avatar image
leeyencuhn asked

RewardAdActivityRequest Invalid input parameters

I check my placementID and rewardID get from GetAdPlacements() is correct, but I still get error message: Invalid input parameters.

Below is my snipet code

GetAdPlacementsRequest request = new GetAdPlacementsRequest();
                request.AppId = appID;
                PlayFabClientAPI.GetAdPlacements(request, result => {
                    rewardID = result.AdPlacements[0].RewardId;
                    placementId = result.AdPlacements[0].PlacementId;
                    Debug.Log("rewardID: " + rewardID);
                    Debug.Log("placementID: " + placementId);
                }, err => Debug.Log("OnUnityAdsDidFinish GetAdPlacements fail"));


                RewardAdActivityRequest requestA = new RewardAdActivityRequest();
                requestA.PlacementId = placementId;
                requestA.RewardId = rewardID;
                PlayFabClientAPI.RewardAdActivity(requestA, result => Debug.Log("AD Success: " + PlayFabSimpleJson.SerializeObject(result)), err => Debug.Log("AD error: " + err.ErrorMessage));
unity3dandroid
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Seth Du avatar image
Seth Du answered

According to your code, GetAdPlacements and RewardAdActivity API are called asynchronously, which means the code below is not receiving any data from GetAdPlacements:

RewardAdActivityRequest requestA = new RewardAdActivityRequest();

requestA.PlacementId = placementId;

requestA.RewardId = rewardID;

You may confirm it via checking those values before RewardAdActivity is called.

I will suggest putting RewardAdActivity in the callback of GetAdPlacements to solve this issue(though you will need to follow https://docs.microsoft.com/en-us/gaming/playfab/features/automation/rewarded-ads/quickstart to handle the process).

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

leeyencuhn avatar image leeyencuhn commented ·

Thank you! I got it.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.