You need to enable JavaScript to run this app.
TrafficRoute DNS 套件

TrafficRoute DNS 套件

复制全文
Android SDK
IHttpDnsDepend 接口
复制全文
IHttpDnsDepend 接口

定义

public interface IHttpDnsDepend

作用

定义了初始化 SDK 所需要的信息。

方法

getContext

Context getContext()

向 SDK 传入 Android 的 Context

您需要重写该方法并在返回值中传入 Context。例如:

@Override
public Context getContext() {
    return mContext;
}

getHttpdnsAccountID

String getHttpdnsAccountID()

向 SDK 传入 Service ID。

您需要重写该方法并在返回值中传入 Service ID。例如:

@Override
public String getHttpdnsAccountID() {
    return "xxxxxx";
}

getHttpdnsSecretKey

String getHttpdnsSecretKey()

向 SDK 传入 Secret Key。您需要重写该方法并在返回值中传入 Service Key。例如:

@Override
public String getHttpdnsSecretKey() {
    return "xxxxxx";
}

getPreloadDomains

String[] getPreloadDomains();

指定 SDK 进行预解析的域名列表。SDK 初始化或应用连接到另一个网络时,SDK 会提前请求预解析域名的解析结果。该方法会对预解析域名的列表进行全量更新。如果您不需要设置预解析域名,可以传入 null。

您需要重写该方法并在返回值中传入参数。例如:

@Override
public String[] getPreloadDomains() {
    return new String[]{"www.bytedance.com"};
}

SDK 初始化之后,如果您需要更新预解析域名列表,可以调用 setPreloadHosts 方法。

getAppId

String getAppId()

设置应用 ID。

您可以在控制台创建应用,并把应用的 应用ID 传入 getAppId 的返回值。这样,您就可以区分同一火山引擎账号下的多个应用,并且为应用单独配置自定义解析。参见 应用管理 了解详细信息。

如果您不需要设置 App ID,可以传入 null。

您需要重写该方法并在返回值中传入参数。例如:

@Override
public String getAppId() {
   return null;
}

isTemporaryAuthentication

@Deprecated
boolean isTemporaryAuthentication();

说明

该方法已废弃。

设置 SDK 是否使用临时 Key 鉴权。

getHttpdnsTemporaryKeyTimeStamp

@Deprecated
long getHttpdnsTemporaryKeyTimeStamp();

说明

该方法已废弃。

向 SDK 传入临时 Key 时间戳。

相关方法

setHttpDnsDepend

最近更新时间:2023.06.21 19:27:08
这个页面对您有帮助吗?
有用
有用
无用
无用