Safe to run
Search
⌃K

Application setup

We assume you have already configured safe to run 'resilience' as outlined here:
To get started, add the gradle dependency (be sure to use version 2.2.4 or greater):
"com.safetorun.safeToRunLogger:$safeToRunVersion"
Then, where you are using your existing 'safeToRun' configuration - simply use "safeToRunWithLogger" - name the check something intuitive, as this is what will appear in the logs on the backend
Use the API key for the application setup in the safe to run - plus portal.
​
initialiseSafeToRunPlus("YourAPIKey")
After that, in order to use with Safe to run resilience:
val result = safeToRunWithLogger(
logger = logger(checkName),
{ verifySignatureCheck() },
{ banAvdEmulatorCheck() }
)
​
if (!result) {
throw UnsafeDeviceException()
}
Or, to use with safe to run verify, use:
​
val isSafe = request.url.toString().verify {
withLogger(
true,
view.context.verifyLogger(
"WebViewSample"
)
)
"file:///android_asset/index.html".allowUrl()
}
Every time the safe to run check is triggered, it will pass the success status along with debug information about the device to the safe to run app.
The logs may not appear instantly - the synchronisation is periodic so it may take a while to appear on the API. The timestamp will be correct for the time that the event happened (rather than the time it was received by the server)
​