Attachments

You can instruct the SDK to quietly attach any file to a bug report. The files you attach are not visible to the user in the SDK.

Introduction

Send yourself XMPP logs, a user's profile photo, or whatever helps you debug issues faster. You will see these files in the center of your web Dashboard along with files the user maybe attached themselves.

Attachments screen

Methods

You can quietly attach files by using any of the methods described below.

Setting a custom filename and then attaching a file

ShakeFile can be initialized with a desired filename (String) and an absolute file path (String) to your file, or instead of a file path you can initialize it with the actual file object (java.io.File).

To define which files will be uploaded when a user reports a bug, you must call the Shake.onPrepareData() method overriding the attachedFiles method inside, as shown in the example below.

You can call the Shake.onPrepareData() method anywhere within your app, but be careful only to call it once since any subsequent calls will override the former ones.

App.kt
Shake.onPrepareData(object: ShakeReportData {
override fun attachedFiles(): List<ShakeFile> {
val shakeFileOne = ShakeFile(File("PathToYourFile"))
val shakeFileTwo = ShakeFile("AbsolutePathToYourFile")
return listOf(shakeFileOne, shakeFileTwo)
}
})

Attaching a file without the custom filename

ShakeFile can be initialized without a filename (String), with just an absolute file path (String) to your file, or instead of a file path you can initialize it with the actual file object (java.io.File). If you initialize it this way, filename shown on the web Dashboard will be determined automatically from the passed file's name.

To define which files will be uploaded when a user reports a bug, you must call the onPrepareData method overriding the attachedFiles method inside, as shown in the example below.

You can call the Shake.onPrepareData() method anywhere in your app, but be careful only to call it once, since subsequent calls will override the former ones.

App.kt
Shake.onPrepareData(object: ShakeReportData {
override fun attachedFiles(): List<ShakeFile> {
val shakeFileOne = ShakeFile("fileOne", File("PathToYourFile"))
val shakeFileTwo = ShakeFile("fileTwo", "AbsolutePathToYourFile")
return listOf(shakeFileOne, shakeFileTwo)
}
})

Limitations

The maximum number of attached files per bug is 1 for Free workspaces and 10 for Premium ones. If more files are attached, the SDK will successfully upload only some of them.

The maximum allowed individual size for any of those files is 5 MB. If you attach a file that's larger than that it won't be uploaded with the report.