package «your.package.name»;
import android.app.Activity;
import android.os.Bundle;
import com.applovin.communicator.AppLovinCommunicator;
import com.applovin.communicator.AppLovinCommunicatorMessage;
import com.applovin.communicator.AppLovinCommunicatorSubscriber;
import androidx.annotation.Nullable;
public class ExampleActivity
implements AppLovinCommunicatorSubscriber
protected void onCreate(@Nullable final Bundle savedInstanceState)
super.onCreate( savedInstanceState );
AppLovinCommunicator.getInstance( getApplicationContext() ).subscribe( this, "max_revenue_events" );
protected void onDestroy()
// Unsubscribe when subscription is no longer needed
AppLovinCommunicator.getInstance( getApplicationContext() ).unsubscribe( this, "max_revenue_events" );
public void onMessageReceived(final AppLovinCommunicatorMessage message)
// If you are subscribed to multiple topics, check for the desired one
if ( "max_revenue_events".equals( message.getTopic() ) )
Bundle data = message.getMessageData();
double revenue = data.getDouble( "revenue" );
String countryCode = data.getString( "country_code" ); // "US" for the United States, etc - Note: Do not confuse this with currency code which is "USD"
String networkName = data.getString( "network_name" ); // Display name of the network which showed the ad
String adUnitId = data.getString( "max_ad_unit_id" ); // The MAX Ad Unit ID
String thirdPartyAdPlacementId = data.getString( "third_party_ad_placement_id" ); // The ad's placement id, if any (bidding may not have one)
String adFormat = data.getString( "ad_format" ); // The ad format of the ad (e.g. "BANNER", "MREC", "INTER", "REWARDED", "REWARDED_INTER")
public String getCommunicatorId()
return "«your_company_name_in_snake_case»";