首页 > 解决方案 > Android - SafetyNet 安全浏览 API

问题描述

只是试图在 Android 应用程序中实现 SafetyNet 安全浏览 API 并阅读以下文档:https ://developer.android.com/training/safetynet/safebrowsing.html但我无法参考SafetyNet class

例如:他们在文档上说:

要使用安全浏览 API,您必须通过调用 initSafeBrowsing() 来初始化 API 并等待它完成。以下代码片段提供了一个示例:

Tasks.await(SafetyNet.getClient(this).initSafeBrowsing())

我已经搜索了这个 API 库来引用SafetyNet类对象,但我无法引用它。

我试图添加我的 build.gradle :

implementation 'com.google.apis:google-api-services-safebrowsing:v4-rev20190923-1.30.3'

apply plugin: 'com.google.gms.google-services'

但仍然找不到那个类。

任何人都知道如何实现这个 lib 助手?

标签: androidkotlingoogle-play-services

解决方案


好的,这样的业余错误:D .....

代替

implementation 'com.google.apis:google-api-services-safebrowsing:v4-rev20190923-1.30.3'

我应该使用

implementation 'com.google.android.gms:play-services-safetynet:17.0.0'

但是他们没有在官方文档中提到这一点:D,希望在有时感到困惑时对任何人有用


推荐阅读