Android - Debug Mode

Debug mode allows you to view debug logs for the Pilgrim SDK so you can quickly spot any configuration errors and better understand SDK states. In Android, the class PilgrimSdkDebugActivity contains the view for debug mode and is available to developers using the SDK. Developers who wish to display debug mode can do so with the following implementation instructions:

1. Configure Pilgrim

See the quickstart guide to ensure Pilgrim is configured correctly.

2. Add debug dependency

In your build.gradle file’s dependencies, include:

com.foursquare:pilgrimsdk-debugging:2.2.0

3. Turn logging on

When using the builder to instantiate Pilgrim, make sure you enable debug logs and set the log level to Debug:

val builder = PilgrimSdk.Builder(this)
    .consumer(BuildConfig.PILGRIM_API_CLIENT_KEY, BuildConfig.PILGRIM_API_CLIENT_SECRET)
    .logLevel(LogLevel.DEBUG)
    .enableDebugLogs()
PilgrimSdk.with(builder)
PilgrimSdk.Builder builder = new PilgrimSdk.Builder(this)
    .consumer(BuildConfig.PILGRIM_API_CLIENT_KEY, BuildConfig.PILGRIM_API_CLIENT_SECRET)
    .logLevel(LogLevel.DEBUG)
    .enableDebugLogs();
PilgrimSdk.with(builder);

4. Decide View Options

You can show debug mode through a gesture or button. Decide on how you want to show debug mode and ensure you have the application’s context available to start the activity.

5. Start Activity with New Intent

val debugIntent = Intent(this, PilgrimSdkDebugActivity::class.java)
startActivity(debugIntent)
startActivity(new Intent(this, PilgrimSdkDebugActivity.class))

To avoid errors, the variable this should be of type Context

Missing test visits

By default, Android’s debug mode events do not auto update, requiring you to close and reopen the debug mode view to see new activity (including when triggering test visits from the debug mode). You can enable auto autodating by turning on the “Tail” feature available from the debug mode’s menu.

Was this page helpful?
Yes
No
Thank you!