Closed praykov closed 6 years ago
It seems that invoking the async method and calling Result directly on the returned Taks (this makes the method synchronous) is causing the issue. I changed it to use ContinueWith and everything works now. Thanks for the nice plugin.
new InAppPurchase().Make("android.test.purchased").ContinueWith((b) => { if (b.Result) { Debug.WriteLine("OK"); } else { Debug.WriteLine("Fail"); } });
Not sure if its a bug or I am not doing something correctly but invoking CrossInAppBilling.Current.ConnectAsync from the Monogame Game.Update method never returns.
Check out the attached project. InAppBillingTest.zip
Bug Information
Version Number of Plugin: 2.0.0.0 Device Tested On: Samsung Galaxy S8 Simulator Tested On: Version of VS: VS 2017 with the latest update Version of Xamarin: 8.2.0.16 Versions of other things you are using: Monogame 3.0.16.1625
Here is the relevant trace: Loaded assembly: System.Threading.Tasks.dll [External] 05-26 14:31:56.555 D/Mono (14590): Assembly Ref addref Plugin.InAppBilling[0xd9bc01c0] -> Mono.Android[0xd9bc0340]: 5 05-26 14:32:00.469 D/Mono (14590): Assembly Ref addref Plugin.InAppBilling[0xd9bc01c0] -> Plugin.InAppBilling.VendingLibrary[0xd9bc0220]: 2 05-26 14:32:00.470 D/Mono (14590): Assembly Ref addref Plugin.InAppBilling.VendingLibrary[0xd9bc0220] -> Mono.Android[0xd9bc0340]: 6 05-26 14:32:00.470 D/Mono (14590): Assembly Ref addref Plugin.InAppBilling.VendingLibrary[0xd9bc0220] -> mscorlib[0xd9bbf860]: 19 05-26 14:32:00.471 D/Mono (14590): Assembly Ref addref Plugin.InAppBilling[0xd9bc01c0] -> Plugin.CurrentActivity[0xd9bbfec0]: 3 05-26 14:32:00.494 D/Mono (14590): Assembly Ref addref Plugin.InAppBilling[0xd9bc01c0] -> System.Core[0xd9bc0c40]: 5 05-26 14:32:00.544 D/Mono (14590): DllImport searching in: '__Internal' ('(null)'). 05-26 14:32:00.544 D/Mono (14590): Searching for 'java_interop_jnienv_call_boolean_method'. 05-26 14:32:00.544 D/Mono (14590): Probing 'java_interop_jnienv_call_boolean_method'. 05-26 14:32:00.544 D/Mono (14590): Found as 'java_interop_jnienv_call_boolean_method'.