public final class

MegacoolConfig

extends Object
java.lang.Object
   ↳ co.megacool.megacool.MegacoolConfig

Class Overview

Configure core aspects of the SDK.

Summary

Public Constructors
MegacoolConfig()
Create a new config.
Public Methods
MegacoolConfig baseEventListener(BaseEventListener eventListener)
Set a listener for events using the base interface.
MegacoolConfig baseUrl(Uri baseUrl)
Set a custom base url for the shares.
MegacoolConfig eventListener(EventListener eventListener)
Set a listener for events issued by Megacool.
MegacoolConfig wrapper(String wrapper, String version)
If wrapping Megacool from a game engine or other tool, please let us know the wrapper and its version to assist debugging.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public MegacoolConfig ()

Create a new config.

Public Methods

public MegacoolConfig baseEventListener (BaseEventListener eventListener)

Set a listener for events using the base interface. We recommend using eventListener(EventListener) wherever possible as we do not guarantee backwards compatibility with the interface, as we might add new methods to it that you would be forced to implement when updating. If extending the EventListener instead you would not have this problem as you can implement only the callbacks you need.

Parameters
eventListener the listener
Returns
  • the config

public MegacoolConfig baseUrl (Uri baseUrl)

Set a custom base url for the shares. This will be combined with the url set on each share and the referral code to create the absolute url for a given share: https://<base-url><share-url>?_m=<referral-code>

You should prefer setting the base url as a string resource by overriding the resources megacool_base_url_host and megacool_base_url_path. That way you don't need to specify the base url several times, as the host and path variables are used in the manifest to register the app as a handler for the links it sends. Setting it here is primarily intended for the cases where it's hard to specify a string resource.

If this is not set the base url will be a concatenation of the string resources megacool_base_url_host and megacool_base_url_path.

Custom base urls is a paid feature that requires extra configuration on the dashboard to work properly.

Parameters
baseUrl The base url to use when building the absolute share links
Returns
  • the config

public MegacoolConfig eventListener (EventListener eventListener)

Set a listener for events issued by Megacool.

Parameters
eventListener the listener
Returns
  • the config

public MegacoolConfig wrapper (String wrapper, String version)

If wrapping Megacool from a game engine or other tool, please let us know the wrapper and its version to assist debugging.

Parameters
wrapper the name of the wrapper, ie "Unity".
version the wrapper's version, ie "2018.2.1" or "1.2.3-r4".
Returns
  • the config