Search in sources :

Example 1 with InappproductsListResponse

use of com.google.api.services.androidpublisher.model.InappproductsListResponse in project OsmAnd-tools by osmandapp.

the class UpdateSubscriptionImpl method test.

private static void test(AndroidPublisher publisher, String subscriptionId, String purchaseToken) {
    try {
        com.google.api.services.androidpublisher.AndroidPublisher.Inappproducts.List lst = publisher.inappproducts().list(GOOGLE_PACKAGE_NAME_FREE);
        InappproductsListResponse response = lst.execute();
        for (InAppProduct p : response.getInappproduct()) {
            System.out.println("SKU=" + p.getSku() + " type=" + p.getPurchaseType() + " LNG=" + p.getDefaultLanguage() + // " P="+p.getPrices()+
            " Period=" + p.getSubscriptionPeriod() + " Status=" + p.getStatus());
        }
        AndroidPublisher.Purchases purchases = publisher.purchases();
        SubscriptionPurchase subscription = purchases.subscriptions().get(GOOGLE_PACKAGE_NAME_FREE, subscriptionId, purchaseToken).execute();
        System.out.println(subscription.getUnknownKeys());
        System.out.println(subscription.getAutoRenewing());
        System.out.println(subscription.getKind());
        System.out.println(new Date(subscription.getExpiryTimeMillis()));
        System.out.println(new Date(subscription.getStartTimeMillis()));
    // return subscription.getExpiryTimeMillis();
    // return subscripcion.getValidUntilTimestampMsec();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : InappproductsListResponse(com.google.api.services.androidpublisher.model.InappproductsListResponse) AndroidPublisher(com.google.api.services.androidpublisher.AndroidPublisher) SubscriptionPurchase(com.google.api.services.androidpublisher.model.SubscriptionPurchase) InAppProduct(com.google.api.services.androidpublisher.model.InAppProduct)

Aggregations

AndroidPublisher (com.google.api.services.androidpublisher.AndroidPublisher)1 InAppProduct (com.google.api.services.androidpublisher.model.InAppProduct)1 InappproductsListResponse (com.google.api.services.androidpublisher.model.InappproductsListResponse)1 SubscriptionPurchase (com.google.api.services.androidpublisher.model.SubscriptionPurchase)1