Closed hammy33897 closed 1 year ago
How are you calling PurchaseItem? Look at https://github.com/jamesmontemagno/MyStreamTimer/blob/main/MyStreamTimer.Shared/ViewModel/ProViewModel.cs asn example.
Hi James, sorry this was my bad, the calling function was trying to use .Result() and therefore was blocking the thread. once I changed the calling function to be async then it started working just fine.
Original Bad Code: public void Subscribe() { string subscribed; subscribed = PurchaseItem("twiceby.subscription.1").Result;
Corrected Code: public async void Subscribe() { string subscribed; subscribed = await PurchaseItem("oofity.subscription.1");
Bug Information
Version Number of Plugin: 5.6.1 Device Tested On: Samsung Galaxy S11, TCL A509DL Simulator Tested On: N/A - Instructions say needs to be tested on actual device Version of VS: 2022 Version of Xamarin: Forms 5.0.0.2578, Essentials 1.7.5 Versions of other things you are using: NetStandard.Library 2.0.3, System.Collections 4.3.0
Steps to reproduce the Behavior
Implemented plug-in as directed. Debug on actual android device. Targeting Android v10+ Verified mainactivity.cs includes xamarin essentials
Expected Behavior
Some response from billing.ConnectAsync();
Actual Behavior
code hangs on line "var connected = await billing.ConnectAsync();". It never gets to line "if (!connected)" App shows message "wait/close"
Code snippet