Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Xamarin.InAppBilling, how to get Activity not Context in Xamarin.Forms

$
0
0

When a user clicks a button, I want the Google popup to show (if on Android platform of course). I can do it, but only in my regular ProjectName.Droid project. I cannot do it with DependencyService because it needs the current Activity, not Context. Can I somehow do this in Xamarin.Forms?

What I have now:
Xamarin.Forms view and user clicks button, user is then sent to ShoppingCart Activity within the ProjectName.Droid project. Within the ShoppingCart Activity, the Google popup is shown.

What I want:
Xamarin.Forms view and user clicks button, via DependencyService or some other way Google popup is shown. <-- problem I am having here is getting the Activity from Xamarin.Forms for the InAppBillingServiceConnection method.

So my question is, how do I get the current Xamarin.Forms Activity (not Context)? Or how do I get this to work with DependencyService?

//METHOD THAT NEEDS TO REPLACE "this" with current activity so that this can be used with DependencyService.
_serviceConnection = new InAppBillingServiceConnection(this, value);


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>