Advanced Settings

VCS RewardingVCS ErrorsCustom ParamsAlertsDebug Log

VCS Rewarding

VCS is the default rewarding option in the dashboard, so you should not have to make any configuration changes unless you have previously altered the setting.

If modifications to the rewarding settings are required, you can refer back to modifying your app settings.

Implementing the Virtual Currency Callback

Handling VCS is based on asynchronous operations. You must implement a VirtualCurrencyCallback to pass to the request for currency.

This callback provides you with information about the reward that should be provided to your user. In particular, you should use the getDeltaOfCoins method on the VirtualCurrencyReponse object to get the total reward amount to provide to the user.

Implementing the virtual currency callback
importclass="cm-variable">com.fyber.requesters.VirtualCurrencyCallback;
  import com.fyber.currency.VirtualCurrencyResponse;
  import com.fyber.currency.VirtualCurrencyErrorResponse;
  import com.fyber.requesters.RequestError;
  
  [...]
  
  VirtualCurrencyCallback virtualCurrencyCallback = new VirtualCurrencyCallback() {
  @Override
  public void onSuccess(VirtualCurrencyResponse virtualCurrencyResponse) {
  // Reward your user based on the deltaOfCoins parameter
  double deltaOfCoins = virtualCurrencyResponse.getDeltaOfCoins();
  }
  
  @Override
  public void onRequestError(RequestError requestError) {
  // No reward has been returned, so nothing can be provided to the user
  Log.d(TAG, "request error: " + requestError.getDescription());
  }
  
  @Override
  public void onError(VirtualCurrencyErrorResponse virtualCurrencyErrorResponse) {
  // No reward has been returned, so nothing can be provided to the user
  Log.d(TAG, "VCS error received - " + virtualCurrencyErrorResponse.getErrorMessage());
  }
  };
  

Request for New Rewards

To reward your users after they have engaged with a rewarded ad format, you need to make a request to VCS. Unless specified otherwise, a request to VCS will ask for the default currency.

Requesting Rewards
 import com.fyber.requesters.VirtualCurrencyRequester;
  
  [...]
  
  // We can create the requester and make the request in the same line
  VirtualCurrencyRequester.create(virtualCurrencyCallback)
  .request(activity);

Best Practice Check

Most Offer Wall offers will complete and reward the user immediately when they have performed the required action for the offer. Some Offer Wall offers may take some time to complete and reward the user.

To handle both scenarios, we recommend you place requests to VCS in two places in your app:

  1. When the Offer Wall closes, you may make an immediate request for VCS to get most of the rewards, which should come through as soon as the user completes the offer.
  2. Whenever you direct the user to a view in which their total currency is visible, you may make a request for VCS to gather any rewards that may have been credited since the user's last visit to the Offer Wall.

Handling Multiple Currencies

If you have created multiple currencies for your application on your dashboard, chaining a call to forCurrencyID(...) will allow you to request VCS for a specific currency.

Requesting Rewards from New Currency

import com.fyber.requesters.VirtualCurrencyRequester;
      
      [...]
      
      // We can create the requester, set the currency we want, and make the request in the same line
      VirtualCurrencyRequester.create(virtualCurrencyCallback)
      .forCurrencyID(currencyId)
      .request(activity); 

You have now completed the set up the Offer Wall via the SDK.

Active Fyber Debug Log

Fyber provides custom logging to help you troubleshoot your integration. You should activate logging before starting up the Fyber SDK to ensure you will have logs of the startup itself.

Activate Logging
import com.fyber.Fyber;
      
      [...]
      
      @Override
      protected void onResume() {
      Fyber.with(appId, activity)
      .withUserId(userId)
      .withSecurityToken(securityToken)
      .start();
      }

Best Practice Check

We recommend you disable logging before going live.

It is also possible to activate logging on your test devices without having to make the specific call to enableLogging. This is useful if you want to pull your live build from the Google Play Store and troubleshoot it.

You can activate logging via an adb command:

Activate Logging
adb shell setprop log.tag.Fyber VERBOSE

After making the adb command, logging will be active on your test device for all apps until you disable the logging again. You can disable it again at any time with another adb command:

Deactivate Logging
adb shell setprop log.tag.Fyber SUPPRESS

Back to Top ⇧