简体   繁体   English

在xamarin.forms中的应用内购买

[英]In App Purchase in xamarin.forms

I'm building an app using Xamarin.forms and I'd like to implement In-App-Purchase for AppStore and Playstore. 我正在使用Xamarin.forms构建应用程序,并且想为AppStore和Playstore实施In-App-Purchase。

I already have a look on Xamarin.InAppPurchase and Xamarin.Inappbilling components. 我已经看过Xamarin.InAppPurchase和Xamarin.Inappbilling组件。 But they seem do not working well, and I need a complete solution for both platforms. 但是它们似乎不能很好地工作,并且我需要针对两个平台的完整解决方案。

Has anybody got the solution? 有没有人得到解决方案?

Using a component like InAppBilling is certainly the way to do it. 使用InAppBilling之类的组件无疑是实现此目的的方法。

Look at this example using the plugin to see if that solves your problem. 使用插件查看此示例,看看是否可以解决您的问题。

https://forums.xamarin.com/discussion/45937/inapp-billing https://forums.xamarin.com/discussion/45937/inapp-billing

In App Billing is very specific to each platform and hence you are only ever using Dependency Injection of some sort to handle each platform. 在应用内,结算是针对每个平台的,因此您只使用某种形式的依赖注入来处理每个平台。 Hence if no one component does it does both you need to install each component in each individual component into each project 因此,如果没有一个组件同时执行两个操作,则需要将每个单独组件中的每个组件安装到每个项目中

  1. Xamarin.InAppPurchase for iOS 适用于iOS的Xamarin.InAppPurchase
  2. Xamarin.InAppBilling for Android 适用于Android的Xamarin.InAppBilling

If you want to then call them from Xamarin Forms, they need a common interface and then injected into a container (dependency injection). 如果要从Xamarin Forms调用它们,则它们需要一个公共接口,然后注入到容器中(依赖注入)。

If you want to know more about dependency injection do a Google search for dependency injection in Xamarin Forms and you can follow any of the top few articles there. 如果您想了解更多有关依赖项注入的信息,请在Xamarin Forms中进行Google搜索以进行依赖项注入,您可以关注那里的前几篇文章。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM