Skip to main content
Answer

Flutter - canMakePayments() never returns on Android

  • August 19, 2021
  • 4 replies
  • 196 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!

This post has been closed for comments

4 replies

cody
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • August 20, 2021

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
  • October 2, 2021

@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
  • October 2, 2021

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
  • October 4, 2021

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!