java - Firebase Realtime 在调试模式下工作,而不是在运行应用模式下工作
问题描述
我有一个恢复订阅的代码。BillingClient 在启动我的应用程序时检查并确认付款是否已确认。确认付款后,我正在尝试将数据打印到 Firebase Realtime。这在调试模式下工作正常,但是当我在应用程序运行模式下运行它时,它不会将此信息打印到 firebase。当我在调试模式下运行它并勾选 addValue 时,代码可以完美运行。我应该怎么办?请帮我。
谢谢
public void addValue(String productid, String token, String orderid, String signatur, String deviceId, String getUID, Long islemtime, String islem, String timem, String orjiJson) {
String key = mDatabaseReference.child("/subs/").push().getKey();
String languagename = Locale.getDefault().getDisplayLanguage();
Integer status = 0;
Subscriptions subscriptions = new Subscriptions(productid, token, orderid, getUID, signatur, deviceId, languagename, islemtime, islem, timem, orjiJson, status);
mDatabaseReference.child("/subs/").child(key).setValue(subscriptions, new DatabaseReference.CompletionListener() {
@Override
public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) {
hideProgressDialogStatic();
Intent n_act = new Intent(MyApplication.getInstance(), subfinish.class);
n_act.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MyApplication.getInstance().startActivity(n_act);
}
});
}
}
解决方案
如果您在发布版本中使用 ProGuard 或任何混淆,则需要@Keep
在您的类上使用注释。
例子:
import androidx.annotation.Keep
@Keep
public class YourClass {}
推荐阅读
- django - Wagtail - 添加 CSS 类或占位符以形成构建器字段
- flutter - 流侦听器和流控制器异步“交谈”未按预期工作
- html - 布局 ASP.NET Razor 页面中的模态
- jsp - 如何在 JSF 1 中过滤 f:selectItems 中的值
- c# - .NET 的 MongoDB 驱动程序 - 从未调用过 id 属性设置器
- reactjs - 元素隐式具有“任何”类型,因为“字符串”类型的表达式不能用于索引类型“断点”
- python - 如何在 python starlette(fastapi)响应中传递西里尔自定义标头?
- c# - System.IdentityModel.Tokens.SecurityTokenValidationException - 使用的证书具有无法验证的信任链
- canvas - 在 sql 数据库中使用 cron 作业创建图像 html 到画布并存储
- javascript - 如何在 Next.js 中使用 formTag?