Sometimes you are making a secure App, and you do not want to run your App on insecure devices. To check whether the device is secure or not, Google Provides SafetyNet API with Google Play services. In this tutorial, we will make a sample app and use SafetyNet API to check the device security. We will test this app on secure and insecure devices.
The SafetyNet API returns two results. One for Basic Integrity and another one for CTS Profile match. If Basic Integrity is true, the device is not likely tampered. CTS profile match means this device matches with the device that passed Compatability Test Suite. The Basic Integrity is weaker that CTS profile match. If you need higher security, you can use only CTS profile match. Apps like Android Pay use CTS profile match since it requires the device to be most secure.