Skip to content

Commit

Permalink
Add deep-link to manage subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavpandey committed Jan 12, 2025
1 parent 519e193 commit 76467dc
Showing 1 changed file with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 Pranav Pandey
* Copyright 2022-2025 Pranav Pandey
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -61,6 +61,12 @@ public class DynamicBilling {
public static final String URL_GOOGLE_PLAY =
"http://play.google.com/store/account/subscriptions?package=%1$s";

/**
* URL constant to manage subscription inside Google Play.
*/
public static final String URL_GOOGLE_PLAY_SUB =
"http://play.google.com/store/account/subscriptions?sku=%1$s&package=%2$s";

/**
* Singleton instance of {@link DynamicBilling}.
*/
Expand Down Expand Up @@ -572,4 +578,20 @@ public void manageGooglePlay() {
DynamicLinkUtils.viewUrl(getContext(), String.format(
URL_GOOGLE_PLAY, getContext().getPackageName()));
}

/**
* Try to launch manage subscription flow for Google Play.
*
* @param productId The product id for the subscription.
*/
public void manageGooglePlaySubscription(@Nullable String productId) {
if (productId == null) {
manageGooglePlay();

return;
}

DynamicLinkUtils.viewUrl(getContext(), String.format(
URL_GOOGLE_PLAY_SUB, productId, getContext().getPackageName()));
}
}

0 comments on commit 76467dc

Please sign in to comment.