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.
Add to your build.gradle:
dependencies {
implementation 'io.shipbook:shipbooksdk:2.+'
}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)
}- 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
ShipBook.enableInnerLog(true)ShipBook.registerUser(
"user-123",
userName = "johndoe",
fullName = "John Doe",
email = "john@example.com",
phoneNumber = "+1234567890",
additionalInfo = mapOf("role" to "admin")
)ShipBook.logout()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.
ShipBook.screen("HomePage")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")- Sign up at shipbook.io
- Create a new application in the console
- Copy your App ID and App Key from the application settings
For full setup instructions, see the Android documentation.
Elisha Sterngold (ShipBook Ltd.)
ShipBook SDK is available under the MIT license. See the LICENSE file for more info.