Did more testing on Android.
It seems that the Product.hasReceipt will return false, after a certain time has passed after expired, and only if the app is restarted. Its tested with the same build as when I reported the issue, so there’s no change in code or anything.
If I remember correctly, it didn’t reset to false, even after 10 mins, when I reported the issue.
But now I’m seeing it updated as earlier as 3min after expired.
I wonder if it take awhile for Google Play to update the subscription status, or if there’s a cache, somewhere for the product, in the device.
Also, I noticed the expiry time given from the subscription info is different from the one given in Google Play app, even on the first purchase of the subscription. Hence I added more logs to show more subscription infos and noticed that the expire date has the same date and time with the purchase date.
[EDIT start]
Ignore my comment on the expiry time. I didn’t noticed that the month and year value is different.
But the expiry time still remained the time, even after auto-renewed. I’m expecting it to update to the new expiry time after renewed. Do correct me if that shouldn’t be the case.
[EDIT End]
Here’s my code for the log
public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
{
// Overall Purchasing system, configured with products for this application.
_storeController = controller;
// Store specific subsystem, for accessing device-specific store features.
_storeExtensionProvider = extensions;
_transactionHistoryExtensions = extensions.GetExtension<ITransactionHistoryExtensions>();
foreach(var product in _storeController.products.all)
{
var subscriptionManager = GetSubscriptionManager(product.definition.id);
if (subscriptionManager == null) continue;
var info = subscriptionManager.getSubscriptionInfo();
Debug.Logger.Write($"ZR Product: {info.getProductId()}, " +
$"\ngetCancelDate: {info.getCancelDate()}" +
$"\ngetExpireDate: {info.getExpireDate()}" +
$"\ngetFreeTrialPeriodString: {info.getFreeTrialPeriodString()}" +
$"\ngetIntroductoryPrice: {info.getIntroductoryPrice()}" +
$"\ngetIntroductoryPricePeriod: {info.getIntroductoryPricePeriod()}" +
$"\ngetIntroductoryPricePeriodCycles: {info.getIntroductoryPricePeriodCycles()}" +
$"\ngetPurchaseDate: {info.getPurchaseDate()}" +
$"\ngetRemainingTime: {info.getRemainingTime()}" +
$"\ngetSkuDetails: {info.getSkuDetails()}" +
$"\ngetSubscriptionInfoJsonString: {info.getSubscriptionInfoJsonString()}" +
$"\ngetSubscriptionPeriod: {info.getSubscriptionPeriod()}" +
$"\nisAutoRenewing: {info.isAutoRenewing()}" +
$"\nisCancelled: {info.isCancelled()}" +
$"\nisExpired: {info.isExpired()}" +
$"\nisFreeTrial: {info.isFreeTrial()}" +
$"\nisIntroductoryPricePeriod: {info.isIntroductoryPricePeriod()}" +
$"\nisSubscribed: {info.isSubscribed()}" +
$"");
}
}
And the output from the log. (It got cut off after the “isFreeTrial” log…)
2020-12-16 12:12:02.619 9894-9940/com.(…omitted…) I/Unity: ZR Product: (…omitted…).ads.plan1,
getCancelDate: 01/01/0001 00:00:00
getExpireDate: 01/16/2021 03:10:57
getFreeTrialPeriodString:
getIntroductoryPrice: not available
getIntroductoryPricePeriod: 00:00:00
getIntroductoryPricePeriodCycles: 0
getPurchaseDate: 12/16/2020 03:10:57
getRemainingTime: 30.23:58:55.0462350
getSkuDetails: (…omitted…)
getSubscriptionInfoJsonString: (…omitted…)
getSubscriptionPeriod: 31.00:00:00
isAutoRenewing: True
isCancelled: False
isExpired: False
isFreeTrial: False
isIntr
Upon cancelled, and app restarted, isCancelled is showing true, while getCancelDate is returning a default value.
2020-12-16 12:35:20.592 11719-11761/com.(…omitted…) I/Unity: ZR Product: (…omitted…).ads.plan1,
getCancelDate: 01/01/0001 00:00:00
getExpireDate: 01/16/2021 03:10:57
getFreeTrialPeriodString:
getIntroductoryPrice: not available
getIntroductoryPricePeriod: 00:00:00
getIntroductoryPricePeriodCycles: 0
getPurchaseDate: 12/16/2020 03:10:57
getRemainingTime: 30.23:35:37.0726970
getSkuDetails: (…omitted…)
getSubscriptionInfoJsonString: (…omitted…)
getSubscriptionPeriod: 31.00:00:00
isAutoRenewing: False
isCancelled: True
isExpired: False
isFreeTrial: False
is