Android 应用内计费-在我们确认通知()之前,marketplace是否会一直ping我们?

Android 应用内计费-在我们确认通知()之前,marketplace是否会一直ping我们?,android,google-play,Android,Google Play,我将继续使用google提供的应用内计费示例,我想用我的服务器上的一个实现(正如他们推荐的那样)替换他们的安全类。看来我必须在我的服务器上调用实现来替换以下内容: /** * Verifies that the data was signed with the given signature, and calls * {@link ResponseHandler#purchaseResponse(Context, PurchaseState, String, String, long)}

我将继续使用google提供的应用内计费示例,我想用我的服务器上的一个实现(正如他们推荐的那样)替换他们的安全类。看来我必须在我的服务器上调用实现来替换以下内容:

/**
 * Verifies that the data was signed with the given signature, and calls
 * {@link ResponseHandler#purchaseResponse(Context, PurchaseState, String, String, long)}
 * for each verified purchase.
 * @param startId an identifier for the invocation instance of this service
 * @param signedData the signed JSON string (signed, not encrypted)
 * @param signature the signature for the data, signed with the private key
 */
private void purchaseStateChanged(int startId, String signedData, String signature) {
    // Instead of using the local version included on the client,
    // this should be an http call to our server which has the 
    // implementation.
    ArrayList<Security.VerifiedPurchase> purchases;
    purchases = Security.verifyPurchase(signedData, signature);
    if (purchases == null) {
        return;
    }


    // Then the rest gets executed after the http response comes back.
    ...

    confirmNotifications(startId, notifyIds);
/**
*验证数据是否已使用给定签名签名签名,并调用
*{@link ResponseHandler#purchaseResponse(上下文,PurchaseState,字符串,字符串,长)}
*对于每一次验证的购买。
*@param startId此服务调用实例的标识符
*@param signedData已签名的JSON字符串(已签名,未加密)
*@param signature数据的签名,使用私钥签名
*/
私有void purchaseStateChanged(int startId、字符串签名数据、字符串签名){
//而不是使用客户端上包含的本地版本,
//这应该是对具有
//实施。
ArrayList购买;
购买=证券。验证购买(签名数据,签名);
如果(购买==null){
返回;
}
//然后在http响应返回后执行其余部分。
...
确认通知(startId、notifyid);
所以我会替换上面的内容,当我收到服务器的响应时,我会运行confirmNotifications()位等等。但是这里有很多事情可能会出错,网络可能会退出等等。所以我假设市场会一直向我发送消息,直到我成功完成confirmNotifications()位

当我开始在我的服务器上验证时,我有点害怕出错,我收到了一批信用卡已被收费的用户,但他们的设备上没有显示内容

此外,我认为我的应用程序的盗版率很低,但我担心会将我的市场公钥嵌入客户端。如果将来某一天我有一个流行的标题,攻击者可能会从我的一些旧应用程序中获得它(不确定如果他们获得公钥会有多大的危险)


谢谢

是的,市场将继续为您从未提交过确认通知的事件发送通知,如文件所述:

确认通知: 此请求确认您的应用程序收到了购买状态更改的详细信息。Google Play将向您的应用程序发送购买状态更改通知,直到您确认收到通知为止


看看

每隔多长时间发送一次?多长时间?如果我不确认,我会一直收到垃圾邮件吗?很难说。据我所知,每次你连接到市场服务时,市场都会发送确认通知。