Class ButtonMerchant
-
- All Implemented Interfaces:
public final class ButtonMerchantPrimary entry point for the Button merchant library.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceButtonMerchant.AttributionTokenListenerAn interface to receive callbacks each time the attribution token value has been updated.
-
Method Summary
Modifier and Type Method Description static voidconfigure(@NonNull() Context context, @NonNull() String applicationId)Configures ButtonMerchant with your application Id. static voidtrackIncomingIntent(@NonNull() Context context, @NonNull() Intent intent)Checks the passed Intentfor a Button attribution and if present stores the token.static voidreportOrder(@NonNull() Context context, @NonNull() Order order, @Nullable() OrderListener orderListener)Reports an order to Button static voidreportEvent(@NonNull() Context context, @NonNull() String name, @Nullable() Map<String, String> properties)Reports an event and associated properties to Button static voidreportEvent(@NonNull() Context context, @NonNull() String name)static StringgetAttributionToken(@NonNull() Context context)The attributionTokenfrom the last inbound Button attributed Intent.static voidaddAttributionTokenListener(@NonNull() Context context, @NonNull() ButtonMerchant.AttributionTokenListener listener)Registers attribution token listener. static voidremoveAttributionTokenListener(@NonNull() Context context, @NonNull() ButtonMerchant.AttributionTokenListener listener)Unregisters attribution token listener. static voidclearAllData(@NonNull() Context context)Discards the current session and all persisted data. static voidhandlePostInstallIntent(@NonNull() Context context, @NonNull() PostInstallIntentListener listener)Checks to see if the user visited a url prior to installing your app. static Featuresfeatures()An interface through which library features can be enabled/disabled. static ButtonUserActivityactivity()An interface through which user activities can be reported. -
-
Method Detail
-
configure
static void configure(@NonNull() Context context, @NonNull() String applicationId)
Configures ButtonMerchant with your application Id. Note: Get your application Id from from the [Button Dashboard](https://app.usebutton.com)
- Parameters:
context-ContextapplicationId- Your applicationId (required)
-
trackIncomingIntent
static void trackIncomingIntent(@NonNull() Context context, @NonNull() Intent intent)
Checks the passed
Intentfor a Button attribution and if present stores the token.- Parameters:
context- a ) instance that can be used to access app resources like SharedPreferences.
-
reportOrder
static void reportOrder(@NonNull() Context context, @NonNull() Order order, @Nullable() OrderListener orderListener)
Reports an order to Button
- Parameters:
context- a ) instance that can be used to access app resources like SharedPreferences.
-
reportEvent
static void reportEvent(@NonNull() Context context, @NonNull() String name, @Nullable() Map<String, String> properties)
Reports an event and associated properties to Button
- Parameters:
context- a ) instance that can be used to access app resources like SharedPreferences.
-
reportEvent
static void reportEvent(@NonNull() Context context, @NonNull() String name)
-
getAttributionToken
@Nullable() static String getAttributionToken(@NonNull() Context context)
The
attributionTokenfrom the last inbound Button attributed Intent. For attribution to work correctly, you must:- Always access this token directly—*never cache it*.
- Never manage the lifecycle of this token—Button manages the token validity window server-side.
- Always include this value when reporting orders to your order API.
-
addAttributionTokenListener
static void addAttributionTokenListener(@NonNull() Context context, @NonNull() ButtonMerchant.AttributionTokenListener listener)
Registers attribution token listener.
- Parameters:
context- Contextlistener- AttributionTokenListener
-
removeAttributionTokenListener
static void removeAttributionTokenListener(@NonNull() Context context, @NonNull() ButtonMerchant.AttributionTokenListener listener)
Unregisters attribution token listener.
- Parameters:
context- Contextlistener- AttributionTokenListener
-
clearAllData
static void clearAllData(@NonNull() Context context)
Discards the current session and all persisted data.
-
handlePostInstallIntent
static void handlePostInstallIntent(@NonNull() Context context, @NonNull() PostInstallIntentListener listener)
Checks to see if the user visited a url prior to installing your app. If a url is found, onResult will be called on the listener you passed and you are responsible for navigating the user to the relevant content in your app. If a url is not found or an error occurs, onResult will be called on your listener and you can continue with your normal launch sequence. This method checks for a post-install url exactly *one time* after a user has installed your app. Subsequent calls will result in a call to onResult on your listener. You do not need to wait for the listener before continuing with your normal launch sequence but you should be prepared to handle an intent if a post-install url is found.
- Parameters:
context- contextlistener- The listener for be notified when a post install url is found.
-
features
static Features features()
An interface through which library features can be enabled/disabled.
-
activity
static ButtonUserActivity activity()
An interface through which user activities can be reported.
-
-
-
-