单个设备中具有多个用户的应用程序 - Inapp结算订阅 [英] App with multiple User in Single Device - Inapp Billing Subscription

查看:130
本文介绍了单个设备中具有多个用户的应用程序 - Inapp结算订阅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Inapp Billing v3开发具有订阅功能的应用程序。有登录机制来访问该应用程序。如果用户X订阅某个功能并注销。如果用户'Y'在同一设备中登录应用程序,并且用户尝试订阅,则Google Play会告知该产品已被购买。基于帐户的订阅是否已在设备中同步,而不是基于登录应用程序的用户?如果是这样,如何实现我的方案?

I am developing an application with subscription feature using Inapp Billing v3.There is login mechanism to access the application. If a user 'X' subscribes to a feature and logs out. If user 'Y' logs into application in same device and if the user attempts to subscribe, Google play tells that product is already bought. Are the subscriptions based on account synced in the device and not based on the user who logged onto the application? If so how is it possible to implement my scenario?

推荐答案

Google Play应用内结算订阅已绑定到Google Play帐户。因此,只要Google帐户未被更改,该订阅就会被视为对此帐户有效,您无法再次购买。

Google Play in-app billing subscription is bound to Google Play account. So as long and Google account is not changed the subscription is considered valid for this account and you cannot purchase it one more time.

如果您想用Google帐户系统替代您需要欺骗Google Play的自己的帐户。您可以做的是创建一个包含多个不同应用内结算订阅的池(如订阅#1,订阅#2等)。订阅时,您将自己的登录名作为 developerPayload 字段中的附加参数传递。

If you want to substitute Google account system with your own accounts you need to "cheat" Google Play. What you can do is to create a pool of several different in-app billing subscriptions (like subscription #1, subscription #2, etc). When you subscribe you pass your own login as an additional parameter in developerPayload field.

现在,当您枚举所有可用订阅时,检查 developerPayload 字段中是否有一个当前用户帐户。如果没有,那么您认为当前用户没有订阅并且允许使用您生成的订阅池(订阅#1,订阅#2等)中的第一个未使用的订阅进行订阅。只需确保您的池中的订阅数量大于您可能拥有的同一设备上的用户数量。

Now when you enumerate all available subscriptions you check if there is one with current user account in the developerPayload field. If not, then you consider that current user has no subscription and allow to subscribe using the first not used yet subscription from the pool of subscriptions (subscription #1, subscription #2, etc) you generated. Just make sure that there is number of subscriptions in your pool is bigger than number of users on the same device you could have.

这不是一种简单的方式,而是相反为你的情况寻找工作的骗子。

It is not a straightforward way, but rather a cheat to find a workarroung for your situation.

这篇关于单个设备中具有多个用户的应用程序 - Inapp结算订阅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆