Skip to main content
Solved

Flutter - canMakePayments() never returns on Android

  • Aug 19, 2021 9:11 AM UTC
  • 4 replies
  • 589 views

Forum|alt.badge.img+4

To replicate:

Using latest Flutter plugin 3.4.1 and the ‘purchase_tester’ example project

Add an ElevatedButton that calls canMakePayments() 
eg replace the ‘UpsellScreen’ build method with this

@overrideWidget build(BuildContext context) {  return ElevatedButton(    onPressed: () async {      bool _storeAvailable = false;      try {        print("Checking availability");        _storeAvailable = await Purchases.canMakePayments();        print("Store available? $_storeAvailable"); //This line never prints      } on PlatformException catch (e) {        var errorCode = PurchasesErrorHelper.getErrorCode(e);        print("Error was $errorCode");      }    },    child: Text("Check Store Available"),  );}

On Android the call never returns (on iOS it works as expected)

Expected result:
bool returned within a reasonable time (or an exception)

Testing info:
This function was working correctly on vs 3.3.0 of the plugin.

Tested on Android Pixel 4a
Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64)
 

Best answer by cody

Hey @Mark Chaplin!

Version 3.4.5 of the Flutter SDK resolves this issue- give it a shot and let me know if you’re still having issues!

View original
This post has been closed for comments

4 replies

cody
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • Aug 20, 2021 6:22 PM UTC

Hey @Mark Chaplin! 👋

Thanks for reaching out and letting us know about this - the SDK team is looking into this and I’ll follow up as soon as I have more information.


Forum|alt.badge.img+1
  • New Member
  • Oct 2, 2021 9:17 AM UTC

@Mark Chaplin I had the same issue with version 3.4.0, after updating to 3.4.5 canMakePayments work and returning result also for android


Forum|alt.badge.img+4
  • Author
  • New Member
  • Oct 2, 2021 3:35 PM UTC

Thanks, I’ll try it. Seems to be mentioned in the 3.4.5 change log too..
https://pub.dev/packages/purchases_flutter/changelog

Can the SDK team confirm?


cody
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • Answer
  • Oct 4, 2021 3:01 PM UTC

Hey @Mark Chaplin!

Version 3.4.5 of the Flutter SDK resolves this issue- give it a shot and let me know if you’re still having issues!