Sanitize Data (Android)
UI Components
Section titled UI ComponentsSanitized views will be blurred out in the resulting replay. You can add any UI component and it will be automatically removed (to preserve memory) as soon as its not on screen.
import com.openreplay.tracker.OpenReplay
OpenReplay.addIgnoredView(view)
Network Requests
Section titled Network RequestsTwo keys are exported to automatically trim the request/response data: ignoredKeys
for body and ignoredHeaders
for headers. Both, request and response will be sanitized, but body will only be affected if its a valid JSON.
Simply assign a list of strings that you would like to sanitize:
val networkListener = NetworkListener()
networkListener.ignoredHeaders = ["mySecretToken"]
networkListener.ignoredKeys = ["password"]
It is also possible to change the response data before passing it to the listener:
// ... request
var sanitizedData: Any? = null
data?.let {
try {
val json = JSONTokener(it).nextValue()
sanitizedData = customSanitizeFunction(it)
println(json)
} catch (error: JSONException) {
println("Error deserializing JSON: $error")
}
}
networkListener.finish(response, sanitizedData)
Have questions?
Section titled Have questions?If you have any questions about this process, feel free to reach out to us on our Slack or check out our Forum.