本文整理汇总了Java中com.android.billingclient.api.SkuDetailsResponseListener类的典型用法代码示例。如果您正苦于以下问题:Java SkuDetailsResponseListener类的具体用法?Java SkuDetailsResponseListener怎么用?Java SkuDetailsResponseListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SkuDetailsResponseListener类属于com.android.billingclient.api包,在下文中一共展示了SkuDetailsResponseListener类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: querySkuDetailsAsync
import com.android.billingclient.api.SkuDetailsResponseListener; //导入依赖的package包/类
public void querySkuDetailsAsync(@BillingClient.SkuType final String itemType,
final List<String> skuList, final SkuDetailsResponseListener listener) {
// Specify a runnable to start when connection to Billing client is established
Runnable executeOnConnectedService = new Runnable() {
@Override
public void run() {
SkuDetailsParams skuDetailsParams = SkuDetailsParams.newBuilder()
.setSkusList(skuList).setType(itemType).build();
mBillingClient.querySkuDetailsAsync(skuDetailsParams,
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(int responseCode,
List<SkuDetails> skuDetailsList) {
listener.onSkuDetailsResponse(responseCode, skuDetailsList);
}
});
}
};
// If Billing client was disconnected, we retry 1 time and if success, execute the query
startServiceConnectionIfNeeded(executeOnConnectedService);
}
开发者ID:googlecodelabs,项目名称:play-billing-codelab,代码行数:23,代码来源:BillingManager.java
示例2: querySkuDetailsAsync
import com.android.billingclient.api.SkuDetailsResponseListener; //导入依赖的package包/类
public void querySkuDetailsAsync(@SkuType final String itemType, final List<String> skuList,
final SkuDetailsResponseListener listener) {
// Creating a runnable from the request to use it inside our connection retry policy below
Runnable queryRequest = new Runnable() {
@Override
public void run() {
// Query the purchase async
SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
params.setSkusList(skuList).setType(itemType);
billingClient.querySkuDetailsAsync(params.build(),
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(int responseCode,
List<SkuDetails> skuDetailsList) {
listener.onSkuDetailsResponse(responseCode, skuDetailsList);
}
});
}
};
executeServiceRequest(queryRequest);
}
开发者ID:plusCubed,项目名称:velociraptor,代码行数:23,代码来源:BillingManager.java
示例3: handleManagerAndUiReady
import com.android.billingclient.api.SkuDetailsResponseListener; //导入依赖的package包/类
/**
* Executes query for SKU details at the background thread
*/
private void handleManagerAndUiReady() {
final List<SkuRowData> inList = new ArrayList<>();
SkuDetailsResponseListener responseListener = new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(int responseCode,
List<SkuDetails> skuDetailsList) {
// If we successfully got SKUs, add a header in front of it
if (responseCode == BillingResponse.OK && skuDetailsList != null) {
// Repacking the result for an adapter
for (SkuDetails details : skuDetailsList) {
Log.i(TAG, "Found sku: " + details);
inList.add(new SkuRowData(details.getSku(), details.getTitle(),
details.getPrice(), details.getDescription(),
details.getType()));
}
if (inList.size() == 0) {
displayAnErrorIfNeeded();
} else {
mAdapter.updateData(inList);
setWaitScreen(false);
}
}
}
};
// Start querying for in-app SKUs
List<String> skus = mBillingProvider.getBillingManager().getSkus(SkuType.INAPP);
mBillingProvider.getBillingManager().querySkuDetailsAsync(SkuType.INAPP, skus, responseListener);
// Start querying for subscriptions SKUs
skus = mBillingProvider.getBillingManager().getSkus(SkuType.SUBS);
mBillingProvider.getBillingManager().querySkuDetailsAsync(SkuType.SUBS, skus, responseListener);
}
开发者ID:googlecodelabs,项目名称:play-billing-codelab,代码行数:36,代码来源:AcquireFragment.java
示例4: handleManagerAndUiReady
import com.android.billingclient.api.SkuDetailsResponseListener; //导入依赖的package包/类
/**
* Executes query for SKU details at the background thread
*/
private void handleManagerAndUiReady() {
// Start querying for SKUs
List<String> inAppSkus = mBillingProvider.getBillingManager().getSkus(SkuType.INAPP);
mBillingProvider.getBillingManager().querySkuDetailsAsync(SkuType.INAPP, inAppSkus,
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(int responseCode, List<SkuDetails> skuDetailsList) {
if (responseCode == BillingResponse.OK
&& skuDetailsList != null) {
for (SkuDetails details : skuDetailsList) {
Log.w(TAG, "Got a SKU: " + details);
}
}
}
});
// Show the UI
displayAnErrorIfNeeded();
}
开发者ID:googlecodelabs,项目名称:play-billing-codelab,代码行数:23,代码来源:AcquireFragment.java
示例5: querySkuDetailsAsync
import com.android.billingclient.api.SkuDetailsResponseListener; //导入依赖的package包/类
public void querySkuDetailsAsync(@SkuType final String itemType, final List<String> skuList,
final SkuDetailsResponseListener listener) {
// Creating a runnable from the request to use it inside our connection retry policy below
Runnable queryRequest = new Runnable() {
@Override
public void run() {
// Query the purchase async
mBillingClient.querySkuDetailsAsync(itemType, skuList,
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(SkuDetailsResult result) {
listener.onSkuDetailsResponse(result);
}
});
}
};
executeServiceRequest(queryRequest);
}
开发者ID:uthayacloud,项目名称:AndroidInAppBilling,代码行数:20,代码来源:BillingManager.java
示例6: querySkuDetailsAsync
import com.android.billingclient.api.SkuDetailsResponseListener; //导入依赖的package包/类
public void querySkuDetailsAsync(@SkuType final String itemType, final List<String> skuList,
final SkuDetailsResponseListener listener) {
// Creating a runnable from the request to use it inside our connection retry policy below
Runnable queryRequest = new Runnable() {
@Override
public void run() {
// Query the purchase async
SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
params.setSkusList(skuList).setType(itemType);
mBillingClient.querySkuDetailsAsync(params.build(),
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(int responseCode,
List<SkuDetails> skuDetailsList) {
listener.onSkuDetailsResponse(responseCode, skuDetailsList);
}
});
}
};
executeServiceRequest(queryRequest);
}
开发者ID:googlesamples,项目名称:android-play-billing,代码行数:23,代码来源:BillingManager.java
示例7: handleManagerAndUiReady
import com.android.billingclient.api.SkuDetailsResponseListener; //导入依赖的package包/类
/**
* Executes query for SKU details at the background thread
*/
private void handleManagerAndUiReady() {
final List<SkuRowData> inList = new ArrayList<>();
SkuDetailsResponseListener responseListener = new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(int responseCode,
List<SkuDetails> skuDetailsList) {
if (responseCode == BillingResponse.OK && skuDetailsList != null) {
// Repacking the result for an adapter
for (SkuDetails details : skuDetailsList) {
Log.i(TAG, "Found sku: " + details);
inList.add(new SkuRowData(details.getSku(), details.getTitle(),
details.getPrice(), details.getDescription(),
details.getType()));
}
if (inList.size() == 0) {
displayAnErrorIfNeeded();
} else {
mAdapter.updateData(inList);
setWaitScreen(false);
}
}
}
};
// Start querying for in-app SKUs
List<String> skus = mBillingProvider.getBillingManager().getSkus(SkuType.INAPP);
mBillingProvider.getBillingManager().querySkuDetailsAsync(SkuType.INAPP, skus, responseListener);
// Start querying for subscriptions SKUs
skus = mBillingProvider.getBillingManager().getSkus(SkuType.SUBS);
mBillingProvider.getBillingManager().querySkuDetailsAsync(SkuType.SUBS, skus, responseListener);
}
开发者ID:googlecodelabs,项目名称:play-billing-codelab,代码行数:35,代码来源:AcquireFragment.java
示例8: querySkuDetailsAsync
import com.android.billingclient.api.SkuDetailsResponseListener; //导入依赖的package包/类
public void querySkuDetailsAsync(@BillingClient.SkuType final String itemType,
final List<String> skuList, final SkuDetailsResponseListener listener) {
SkuDetailsParams skuDetailsParams = SkuDetailsParams.newBuilder()
.setSkusList(skuList).setType(itemType).build();
mBillingClient.querySkuDetailsAsync(skuDetailsParams,
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(int responseCode,
List<SkuDetails> skuDetailsList) {
listener.onSkuDetailsResponse(responseCode, skuDetailsList);
}
});
}
开发者ID:googlecodelabs,项目名称:play-billing-codelab,代码行数:14,代码来源:BillingManager.java
示例9: querySkuDetailsAsync
import com.android.billingclient.api.SkuDetailsResponseListener; //导入依赖的package包/类
public void querySkuDetailsAsync(@BillingClient.SkuType final String itemType,
final List<String> skuList, final SkuDetailsResponseListener listener) {
SkuDetailsParams skuDetailsParams = SkuDetailsParams.newBuilder().setSkusList(skuList)
.setType(itemType).build();
mBillingClient.querySkuDetailsAsync(skuDetailsParams,
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(int responseCode, List<SkuDetails> skuDetailsList) {
listener.onSkuDetailsResponse(responseCode, skuDetailsList);
}
});
}
开发者ID:googlecodelabs,项目名称:play-billing-codelab,代码行数:13,代码来源:BillingManager.java
示例10: querySkuDetailsAsync
import com.android.billingclient.api.SkuDetailsResponseListener; //导入依赖的package包/类
public void querySkuDetailsAsync(@BillingClient.SkuType final String itemType,
final List<String> skuList, final SkuDetailsResponseListener listener) {
SkuDetailsParams skuDetailsParams = SkuDetailsParams.newBuilder()
.setSkusList(skuList).setType(itemType).build();
mBillingClient.querySkuDetailsAsync(skuDetailsParams,
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(int responseCode,
List<SkuDetails> skuDetailsList) {
listener.onSkuDetailsResponse(responseCode, skuDetailsList);
}
});
}
开发者ID:googlecodelabs,项目名称:play-billing-codelab,代码行数:14,代码来源:BillingManager.java
示例11: addSkuRows
import com.android.billingclient.api.SkuDetailsResponseListener; //导入依赖的package包/类
private void addSkuRows(final List<SkuRowData> inList, List<String> skusList,
final @SkuType String billingType, final Runnable executeWhenFinished) {
mBillingProvider.getBillingManager().querySkuDetailsAsync(billingType, skusList,
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(int responseCode, List<SkuDetails> skuDetailsList) {
if (responseCode != BillingResponse.OK) {
Log.w(TAG, "Unsuccessful query for type: " + billingType
+ ". Error code: " + responseCode);
} else if (skuDetailsList != null
&& skuDetailsList.size() > 0) {
// If we successfully got SKUs, add a header in front of the row
@StringRes int stringRes = (billingType == SkuType.INAPP)
? R.string.header_inapp : R.string.header_subscriptions;
inList.add(new SkuRowData(getString(stringRes)));
// Then fill all the other rows
for (SkuDetails details : skuDetailsList) {
Log.i(TAG, "Adding sku: " + details);
inList.add(new SkuRowData(details, SkusAdapter.TYPE_NORMAL,
billingType));
}
if (inList.size() == 0) {
displayAnErrorIfNeeded();
} else {
if (mRecyclerView.getAdapter() == null) {
mRecyclerView.setAdapter(mAdapter);
Resources res = getContext().getResources();
mRecyclerView.addItemDecoration(new CardsWithHeadersDecoration(
mAdapter, (int) res.getDimension(R.dimen.header_gap),
(int) res.getDimension(R.dimen.row_gap)));
mRecyclerView.setLayoutManager(
new LinearLayoutManager(getContext()));
}
mAdapter.updateData(inList);
setWaitScreen(false);
}
}
if (executeWhenFinished != null) {
executeWhenFinished.run();
}
}
});
}
开发者ID:googlesamples,项目名称:android-play-billing,代码行数:50,代码来源:AcquireFragment.java
注:本文中的com.android.billingclient.api.SkuDetailsResponseListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论