文档的内容如下:
从2021年8月2日开始,所有新的应用程序都必须使用计费库版本3或更高版本。到2021年11月1日,所有对现有应用程序的更新都必须使用计费库版本3或更高版本。
这就是这种依赖关系:
implementation "com.android.billingclient:billing:3.0.2"如何向计费客户端传递类似的用户ID?
发布于 2021-02-11 16:06:24
可以通过accountId和profileId传递BillingFlowParams
String accountId = "";
String profileId = "";
BillingFlowParams.Builder builder = BillingFlowParams.newBuilder().setSkuDetails(skuDetail);
if (this.accountId != null) {builder.setObfuscatedAccountId(accountId);}
if (this.profileId != null) {builder.setObfuscatedProfileId(profileId);}
BillingFlowParams billingFlowParams = builder.build();然后,在onPurchasesUpdated()上,可以从Purchase检索AccountIdentifiers
@Override
public void onPurchasesUpdated(@NonNull BillingResult billingResult, @Nullable List<Purchase> items) {
if(items != null && items.size() > 0) {
for (Purchase item : items) {
if (item.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {
...
AccountIdentifiers identifiers = item.getAccountIdentifiers();
if(identifiers != null) {
String accountId = identifiers.getObfuscatedAccountId();
String profileId = identifiers.getObfuscatedProfileId();
...
}
}
}
}
}https://stackoverflow.com/questions/66158316
复制相似问题