java.lang.Object | ||
↳ | ButtonPrivate | |
↳ | com.usebutton.sdk.Button |
Main entry point to the Button SDK. There's two steps involved in initializing the Button SDK:
android.app.Application.onCreate()
<meta-data android:name="com.usebutton.applicationid" android:value="app-0000000000000000"/>
public class SampleApplication extends android.app.Application { public void onCreate() { super.onCreate(); if (BuildConfig.DEBUG) { Button.getButton(this).enableDebugLogging(); } Button.getButton(this).start(); } }
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method will check if there's any pending deferred deep link for this user
after an installation.
| |||||||||||
Disable SDK debug logging, see
enableDebugLogging() for more details. | |||||||||||
Will enable useful debug logging from the Button SDK (tag Button).
| |||||||||||
Gets the shared Button instance & lazily instantiates if not yet created.
| |||||||||||
You can use this method to check if the current user came in through a DLC deep link or not (null)
| |||||||||||
Record inbound deep link for attribution, currently based on
getData() . | |||||||||||
Clears any session information and effectively creates a new customer.
| |||||||||||
Report a custom named event with an optional dictionary of parameters (JSONObject),
for example a registration or a restaurant table reservation.
| |||||||||||
Will report an order attribution and its value & currency to the active referrer token
handleIntent(Intent) | |||||||||||
Call with a non-
null value to associate your own unique identifier with the current Button
session. | |||||||||||
Initializes Button for your application, preferably called from
android.app.Application.onCreate() . | |||||||||||
Ceases all Button activity.
| |||||||||||
Convenience method to check if a promotion will be filled given a placement ID and context.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
This method will check if there's any pending deferred deep link for this user
after an installation. You'd want to check this in your main launcher intent activity's onCreate.
Remember to call start()
first.
Your receiver will be called with an instance of Uri
or null, use this Uri as data
for a ACTION_VIEW
intent.
Since we have to ask our servers this might take a few seconds, you're welcome to guard
against this taking too long by recording the start time in milliseconds and when
the callback happens, see our FAQ for an example.
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); Button.getButton(this).start(); Button.getButton(this).checkForDeepLink(new Receiver() { @Override public void receive(final Uri uri) { if (uri == null) { return; } // Deep link received, let's open it. startActivity(new Intent(Intent.ACTION_VIEW, uri)); // Unless you want this activity in the back stack, call finish(); } }); setContentView(R.layout.your_activity); // ... }
Disable SDK debug logging, see enableDebugLogging()
for more details.
Will enable useful debug logging from the Button SDK (tag Button).
We recommend you call this function before start()
.
Use adb logcat ButtonSDK:D *:S
to filter on Button log statements only.
Gets the shared Button instance & lazily instantiates if not yet created.
You can use this method to check if the current user came in through a DLC deep link or not (null)
handleIntent(Intent)
or null if none.
Record inbound deep link for attribution, currently based on getData()
.
Will see if getData()
has a btn_ref=:referrerToken
URL parameter on the data provided
and record this referrer token for future attribution through reportOrder(int, String, String)
,
see also getReferrerToken()
.
Clears any session information and effectively creates a new customer. Use when e.g. the user logs out or changes in the host application.
Report a custom named event with an optional dictionary of parameters (JSONObject), for example a registration or a restaurant table reservation.
name | (required), e.g. "registration", "cancellation", "booking", "reservation" |
---|---|
parameters | (optional) |
Will report an order attribution and its value & currency to the active referrer token handleIntent(Intent)
valuePennies | closest value in pennies, for $4.50 = 450 |
---|---|
currencyCode | the currency of this order e.g. USD or NOK |
orderId | your order ID |
Call with a non-null
value to associate your own unique identifier with the current Button
session. For example, this value can be a username, e-mail address, or profile ID. It can be used
with certain Button backend reporting features.
thirdpartyId | the unique id to associate, or null to disassociate
|
---|
Initializes Button for your application, preferably called from android.app.Application.onCreate()
.
Remember to add your application ID to your AndroidManifest.xml first, see Button
for example
Ceases all Button activity.
Convenience method to check if a promotion will be filled given a placement ID and context. See ButtonDropin
for more information about context. You can use this to e.g. show/hide ButtonDropin
's layout container.
For instructions on finding your buttonId, see Button
<com.usebutton.sdk.ButtonDropin
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_margin="10dp"
button:buttonId="your-button-id"
button:textColor="@color/white"
button:textSize="18dp"
/>
buttonId | same buttonId as you would use in your layout declaration for ButtonDropin |
---|---|
context | See ButtonDropin |
listener | will be called with onPrepared(true) if we will fill a button for this context
|