所以我有一个计费客户端,我用它实例化
billingClient = BillingClient.newBuilder(this).setListener(this).build();然后我打电话
billingClient.startConnection(new BillingClientStateListener() {
@Override
public void onBillingSetupFinished(int responseCode) {
//TODO: use this for stuff
com.android.billingclient.api.Purchase.PurchasesResult result;
result = billingClient.queryPurchases(BillingClient.SkuType.SUBS);
Timber.d(result.toString());
}
@Override
public void onBillingServiceDisconnected() {
//TODO: use this for stuff
Timber.d("something went wrong ");
}
});无论出于什么原因,木材线路上的断点总是断开。有人能给我提供洞察力或榜样来说明我是如何做到这一点的吗?
发布于 2018-05-23 18:27:44
结果发现,我没有使用我的apk的版本,该版本是用正确的版本编号签名的。有一次,我修正了,我能够连接到播放服务,并找出我想要什么。
发布于 2018-11-03 13:07:53
我遇到了这个问题。还请确保启动连接:
mBillingClient = BillingClient.newBuilder(mContext).setListener(purchasesUpdatedListener).build();
mBillingClient.startConnection(new BillingClientStateListener() {
@Override
public void onBillingSetupFinished(@BillingClient.BillingResponse int billingResponseCode) {
if (billingResponseCode == BillingClient.BillingResponse.OK) {
Log.d(TAG, "onBillingSetupFinished: BillingClient.BillingResponse.OK ");
}
}
@Override
public void onBillingServiceDisconnected() {
// Try to restart the connection on the next request to
// Google Play by calling the startConnection() method.
}
});发布于 2021-12-05 14:28:26
如果您使用自定义rom或根设备,它可能无法工作。
运行Google客户端应用程序是预装的系统映像。如果Google是,没有在系统映像中预装,您的应用程序将无法与Google许可服务器通信。
https://developer.android.com/google/play/licensing/setting-up
https://stackoverflow.com/questions/49908462
复制相似问题