Debug Button on
Android

Debug Button

If you're having trouble configuring the SDK or seeing your Button you can enable debug logging when you initiate your Button to see what's going on. To do so, add the following line when initiating Button.

if (BuildConfig.DEBUG) {
    Button.enableDebugLogging()
}
if (BuildConfig.DEBUG) {
    Button.enableDebugLogging();
}

Your new onCreate() method in your application will look like this:

class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()

        if (BuildConfig.DEBUG) {
            Button.enableDebugLogging()
        }
        Button.getButton(this).start()
    }
}
public class MyApplication extends Application {
  @Override
  public void onCreate() {
      super.onCreate();

      if (BuildConfig.DEBUG) {
        Button.enableDebugLogging();
      }
      Button.getButton(this).start();
  }
}

Note: You should not ship to the Google Play store with this enabled.

With debug logging enabled, Button will log to the standard log output with the success or failure of the following operations:

  • Button SDK Initialization
  • Creating a session with Button
  • Rendering a Button
  • Interactions with the Commerce Card
  • All operations which failed (including simply not matching an action for the current context) will print with the log statement a Request ID in the format req-xxxxxxxxx.

If you can't figure out why your Button isn't working, contact us and send this token to our support team and we can then investigate why things aren't working as expected.