For saftey environment check in android I was using
https://developer.android.com/training/safetynet/attestation.html
SafetyNet.getClient(this).attest(nonce, API_KEY)
.addOnSuccessListener(this,successListner)
.addOnFailureListener(this,failureListener)
for which I am getting failure callback with network error null. Can anybody please throw some light on this ?
but https://medium.com/@hargoyal/secure-android-app-with-safetynet-8e367a1c8ad0
SafetyNet.SafetyNetApi.attest(mGoogleApiClient, nonce)
.setResultCallback(new ResultCallback<SafetyNetApi.AttestationResult>() {
@Override
public void onResult(SafetyNetApi.AttestationResult result) {
Status status = result.getStatus();
if (status.isSuccess()) {
decodeJws(result.getJwsResult());
// Indicates communication with the service was successful.
// Use result.getJwsResult() to get the result data.
} else {
// An error occurred while communicating with the service.
}
}
});
this approach is working but SafetyNet.SafetyNetApi is deprecated.