adjust-icon

Helium by Chartboost SDK 集成

如果您想使用 Helium by Chartboost SDK 监测广告收入,可以借助 SDK 到 SDK 集成,将数据发送到 Adjust 服务器。

示例

public void ilrdObserver (final HeliumImpressionData impData) {
final AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue("helium_chartboost_sdk");
// extract the ILRD payload
final JSONObject json = impData.getIlrdInfo();
try {
final double adRevenue = json.getDouble("ad_revenue");
final String currencyType = json.getString("currency_type");
adjustAdRevenue.setRevenue(adRevenue, currencyType);
} catch (JSONException e) {
// error handling as either revenue or currency was not present
return;
}
// optional fields
final String networkName = json.optString("network_name"); // Helium demand network name
final String placementName = json.optString("placement_name"); // Helium placement name
final String lineItemName = json.optString("line_item_name"); // Helium line item name
adjustAdRevenue.setAdRevenueNetwork(networkName);
adjustAdRevenue.setAdRevenueUnit(placementName);
adjustAdRevenue.setAdRevenuePlacement(lineItemName);
// Send Adjust ad revenue
Adjust.trackAdRevenue(adjustAdRevenue);
}