【问题标题】:How to test Google Play Real Time Notifications for Subscriptions?如何测试订阅的 Google Play 实时通知?
【发布时间】:2020-01-13 12:22:11
【问题描述】:

我正在尝试在我的应用中实现应用内订阅。所以,首先我设置了实时通知。但问题是我无法测试它们的应用内订阅。谁能帮我这个?让我描述一下我所拥有的。

  1. 我创建了主题
  2. 在该主题中创建了订阅
  3. 在订阅中添加了端点
  4. 在 play.google.com 的“服务和 API”部分添加了主题名称
  5. 在我的服务器上添加了端点,所以我可以接收请求

当我点击 SEND TEST NOTIFICATION 按钮时,我可以成功接收请求,但问题是请求没有任何值,如此处所述。

https://developer.android.com/google/play/billing/realtime_developer_notifications

根据链接,

Each publish made to a Pub/Sub topic contains a single base64-encoded DeveloperNotification with the following fields:
{
  "version": string,
  "packageName": string
  "eventTimeMillis": long
  "oneTimeProductNotification": OneTimeProductNotification
  "subscriptionNotification": SubscriptionNotification
  "testNotification": TestNotification
}

A TestNotification contains the following fields:
{
  "version": string
}

所以我的问题是,如何测试这个 Json?我的意思是为什么请求没有值?

谢谢。

【问题讨论】:

    标签: android google-play in-app-purchase in-app-billing in-app-subscription


    【解决方案1】:

    对不起,伙计们。 我发现了问题。 我试图以错误的方式获取这些字段。由于我的服务器技术是 PHP,我试图从 $_POST 数组中获取,但正确的方法是

    $result = file_get_contents("php://input");
    

    【讨论】:

    • 你能分享你的php代码吗?解码服务器通知。我正在做同样的事情并在解码消息时感到震惊
    • @IsrarAhmad 是的。这里是。 pastebin.pl/view/7f3f1d0b
    猜你喜欢
    • 1970-01-01
    • 2019-12-09
    • 2019-08-10
    • 1970-01-01
    • 1970-01-01
    • 2018-06-09
    • 1970-01-01
    • 2016-05-10
    • 1970-01-01
    相关资源
    最近更新 更多