Welcome to mirror list, hosted at ThFree Co, Russian Federation.

LaunchBillingFlowRequest.java « purchase « maps « mapswithme « com « src « android - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c2c148abd77cce23f3c2582e7d753bb5d427738d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.mapswithme.maps.purchase;

import android.app.Activity;
import androidx.annotation.NonNull;

import com.android.billingclient.api.BillingClient;
import com.android.billingclient.api.BillingFlowParams;

import static com.mapswithme.maps.purchase.PlayStoreBillingManager.LOGGER;
import static com.mapswithme.maps.purchase.PlayStoreBillingManager.TAG;

class LaunchBillingFlowRequest extends PlayStoreBillingRequest
{
  @NonNull
  private final String mProductId;
  @NonNull
  private final Activity mActivity;

  LaunchBillingFlowRequest(@NonNull Activity activity, @NonNull BillingClient client,
                                  @NonNull String productType, @NonNull String productId)
  {
    super(client, productType);
    mActivity = activity;
    mProductId = productId;
  }

  @Override
  public void execute()
  {
    BillingFlowParams params = BillingFlowParams.newBuilder()
                                                .setSku(mProductId)
                                                .setType(getProductType())
                                                .build();

    int responseCode = getClient().launchBillingFlow(mActivity, params);
    LOGGER.i(TAG, "Launch billing flow response: " + responseCode);
  }
}