如何在 Android 中注销 Apptentive?
How to unregister Apptentive in Android?
我需要禁用 Apptentive 显示其反馈对话框,因为它会干扰我的 UI 测试。我找不到任何注销或禁用它的方法。
我尝试像这样设置随机应用程序密钥,但 apptentive 正在使用缓存的 API 密钥。
@BeforeClass
public static void beforeClass() {
Apptentive.register(CustomApp.getInstance(), "");
}
您无法在 Apptentive 注册后取消注册,但是有几种方法可以防止它在您 运行 您的 UI 测试时出现。
为您的 UI 测试使用特殊的构建变体。然后,在 Application.onCreate()
中,将对 Apptentive.register()
的调用包装在对构建配置 flavor
的检查中
@Override
onCreate() {
if (!BuildConfig.FLAVOR.equals("<YOUR_UI_TEST_FLAVOR>")) {
Apptentive.register(...);
}
}
您可以像Apptentive.addCustomPersonData("ui_test", true)
一样设置一条自定义人物数据。然后,在您的交互 "Who" 条件中使用它,这样只要此标志为真,Interaciton 就不会显示。
我需要禁用 Apptentive 显示其反馈对话框,因为它会干扰我的 UI 测试。我找不到任何注销或禁用它的方法。 我尝试像这样设置随机应用程序密钥,但 apptentive 正在使用缓存的 API 密钥。
@BeforeClass
public static void beforeClass() {
Apptentive.register(CustomApp.getInstance(), "");
}
您无法在 Apptentive 注册后取消注册,但是有几种方法可以防止它在您 运行 您的 UI 测试时出现。
为您的 UI 测试使用特殊的构建变体。然后,在
的检查中Application.onCreate()
中,将对Apptentive.register()
的调用包装在对构建配置 flavor@Override onCreate() { if (!BuildConfig.FLAVOR.equals("<YOUR_UI_TEST_FLAVOR>")) { Apptentive.register(...); } }
您可以像
Apptentive.addCustomPersonData("ui_test", true)
一样设置一条自定义人物数据。然后,在您的交互 "Who" 条件中使用它,这样只要此标志为真,Interaciton 就不会显示。