Skip to content

About

Shipbook Android SDK: remote logging for Kotlin and Java apps. See the logs of every user session in the cloud.

Topics

Resources

Stars

31 stars

Watchers

3 watching

Forks

Repository files navigation

ShipBook SDK for Android

Maven Central

Shipbook SDK for Android applications. Capture logs, errors, and exceptions from your Android apps and view them in the Shipbook console. Learn more at shipbook.io.

Installation

Add to your build.gradle:

dependencies {
    implementation 'io.shipbook:shipbooksdk:2.+'
}

Quick Start

import io.shipbook.shipbooksdk.ShipBook
import io.shipbook.shipbooksdk.Log

// Initialize Shipbook (do this once in Application.onCreate)
ShipBook.start(application, "YOUR_APP_ID", "YOUR_APP_KEY")

// Get a logger for your class/component
val log = ShipBook.getLogger("MainActivity")

// Log messages at different severity levels
log.v("Detailed trace information")
log.d("Debug information")
log.i("General information")
log.w("Warning message")
log.e("Error message")

// Log with an exception
try {
    throw IllegalStateException("Something failed")
} catch (e: Exception) {
    log.e("Operation failed", e)
}

Features

  • Remote Logging - View all your app logs in the Shipbook console
  • Error Tracking - Automatically captures uncaught exceptions
  • Session Tracking - Group logs by user session
  • Offline Support - Logs are queued and sent when connectivity is restored
  • Dynamic Configuration - Change log levels remotely without redeploying
  • User Identification - Associate logs with specific users

Configuration

Enable Inner Logging (Debug Mode)

ShipBook.enableInnerLog(true)

Register User

ShipBook.registerUser(
    "user-123",
    userName = "johndoe",
    fullName = "John Doe",
    email = "john@example.com",
    phoneNumber = "+1234567890",
    additionalInfo = mapOf("role" to "admin")
)

Logout

ShipBook.logout()

Link Sessions with Your Backend

Add the session headers to requests toward your own backend, and the Shipbook console links this app session to the sessions those requests create in your Node.js backend. With OkHttp, add them once in an interceptor:

val client = OkHttpClient.Builder()
    .addInterceptor { chain ->
        val request = chain.request().newBuilder()
        ShipBook.getSessionHeaders().forEach { (name, value) -> request.header(name, value) }
        chain.proceed(request.build())
    }
    .build()

It returns an empty map until login completes, so adding it is always safe.

Screen Tracking

ShipBook.screen("HomePage")

Static Log Methods

You can also use static methods without creating a logger instance:

Log.e("MyTag", "Something went wrong")
Log.w("MyTag", "This is a warning")
Log.i("MyTag", "General info")
Log.d("MyTag", "Debug info")
Log.v("MyTag", "Trace info")

Getting Your App ID and Key

  1. Sign up at shipbook.io
  2. Create a new application in the console
  3. Copy your App ID and App Key from the application settings

For full setup instructions, see the Android documentation.

Links

Author

Elisha Sterngold (ShipBook Ltd.)

License

ShipBook SDK is available under the MIT license. See the LICENSE file for more info.

About

Shipbook Android SDK: remote logging for Kotlin and Java apps. See the logs of every user session in the cloud.

Topics

Resources

Stars

31 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages