- 用户能否评论?-是的,用户可以在应用商店中对应用进行评论和评分。
示例代码:
// 打开应用商店页面,让用户进行评分和评论
Uri uri = Uri.parse("market://details?id=com.example.android");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
- 他们能购买应用内购买吗?-是的,用户可以在应用内进行购买,但需要先将应用发布为正式版。
示例代码:
// 调用内购界面,用户可以进行商品购买
private static final String SKU_ITEM = "com.example.item";
// ...
mBillingClient = BillingClient.newBuilder(mContext)
.setListener(this)
.build();
mBillingClient.startConnection(new BillingClientStateListener() {
@Override
public void onBillingSetupFinished(BillingResult billingResult) {
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
List skuList = new ArrayList<> ();
skuList.add(SKU_ITEM);
SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
params.setSkusList(skuList).setType(BillingClient.SkuType.INAPP);
mBillingClient.querySkuDetailsAsync(params.build(),
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(BillingResult billingResult,
List skuDetailsList) {
if (billingResult.getResponseCode() ==
BillingClient.BillingResponseCode.OK && skuDetailsList != null &&
skuDetailsList.size() > 0) {
SkuDetails skuDetails = skuDetailsList.get(0);
BillingFlowParams flowParams = BillingFlowParams.newBuilder()
.setSkuDetails(skuDetails)
.build();
mBillingClient.launchBillingFlow(getActivity(), flowParams);
}
}
});
}
}
@Override
public void