新的Andr​​oid设备重新安装付费订阅 [英] re-install paid subscription on new Android device

查看:222
本文介绍了新的Andr​​oid设备重新安装付费订阅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程式内订阅。我想,以确保重新安装的应用程序在相同的或新的会认识到,该用户具有有效订阅。该已经拥有的反应应该有7的值,这对于消费品,管理产品工作正常。对于订阅,不过,我没有得到一个7的回应。消息是不同的,也。被管理,可消费产品的信息是与7响应已经拥有物品。对于预订的消息是您已拥有此项目,没有7的反应,IAB的结果是-1005:用户取消。订阅是活跃在谷歌钱包,并没有被取消。我得到的回应,我认为,从警告框被解雇。

I have an inapp subscription. I am trying to insure the re-installation of the app on the same or a new will recognize that the user has a valid subscription. The "already owned" response is supposed to have a value of "7", which works fine for consumable, managed products. For subscriptions, however, I do not get a "7" response. The messages are different, too. For a managed, consumable product the message is "Item already owned" with a "7" response. For subscriptions the message is "You already own this item", with NO "7" response, and the IAB result is "-1005:User cancelled". The subscription is active in Google Wallet, has not been cancelled. I get the response, I believe, from the alert box dismissal.

问题是,我怎么认识这个回应IABsetup?我已经试过,如果request.mResponse = 1,但不起作用。我aparently没有得到有用的回复code的订阅。在测试过程中,我不得不关掉调试上传.apk文件,所以这是更加难以效仿。

The question is, how do I recognize this response to the IABsetup? I have tried if request.mResponse = 1, but that does not work. I aparently do not get a useful response code for subscriptions. During testing, I have to turn off debug to upload the .apk so this is even more difficult to follow.

为什么会从服务器上订阅响应从已经拥有项目管理产品的反应有什么不同?

Why would the subscription response from the server differ from the managed product response for already owned items?

我需要能够根据已经拥有响应启动应用程序。

I need to be able to activate the app based on the already owned response.

感谢。

推荐答案

我发现了IabHelper.java有这样的:

I discovered the IabHelper.java has this:

else if (resultCode == Activity.RESULT_CANCELED) {
        logDebug("Purchase canceled - Response: " + getResponseDesc(responseCode));        
        result = new IabResult(IABHELPER_USER_CANCELED, "User canceled.");
        if (mPurchaseListener != null) mPurchaseListener.onIabPurchaseFinished(result, null);
    }

我改成这样:

else if (resultCode == Activity.RESULT_CANCELED) {
        logDebug("Purchase canceled - Response: " + getResponseDesc(responseCode));        
        result = new IabResult(responseCode, "User canceled.");
        if (mPurchaseListener != null) mPurchaseListener.onIabPurchaseFinished(result, null);
    }

请注意从(IABHELPER_USER_CANCELED,用户取消了。)至(响应code,用户取消)

Note the change from (IABHELPER_USER_CANCELED, "User canceled.") to (responseCode, "User Canceled")

现在响应code被传递给

Now the responseCode is passing to the

public void onIabPurchaseFinished(IabResult result, Purchase info)

这样我就可以决定是否响应是一个对话框,取消,并允许积极认购重新安装,并联系我的服务器。在这一点上我做了0Auth API调用谷歌以验证安装和积极认购。

so I can determine if the response is a dialog cancel and allow the active subscription to re-install and contact my server. At that point I am doing the 0Auth API call to Google to verify the installation and active subscription.

有可能会替代方法可以做到这一点,但这个工作。

There may be alternate ways to do this, but this worked.

希望这有助于该3人在世界上谁在做Android的应用程式内订阅。

Hope this helps the 3 people in the world who are doing Android inapp subscriptions.

这篇关于新的Andr​​oid设备重新安装付费订阅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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