如何为应用内购买实施实时通知(发布/订阅)?

时间:2020-08-18 03:00:10

标签: php android publish-subscribe

我正在尝试根据用户在我的应用中购买或订阅时来自Google的推送通知来更新数据库。为此,我将使用php。 将会发生什么:

  1. 用户在我的应用中进行订阅。
  2. Pub / Sub接收到该数据,并向我提供的链接发送推送通知。
  3. 数据库中的数据已更新。 4.该应用发出一个http请求并获取订阅信息。

我为pub子通知提供了URL,我需要解析数据,发出请求以获取更新的数据并相应地更新数据库。 我知道如何发出请求

    $client = new \Google_Client();
    $client->setAuthConfig('credentials.json');
    $client->addScope('https://www.googleapis.com/auth/androidpublisher');
    $service = new \Google_Service_AndroidPublisher($client);
     $subscription = $service->purchases_subscriptions->get($package_name,
            $product_id,
            $token);

但是我不知道如何处理来自PubSub的订阅或购买并进行相应的处理。我该怎么办?

0 个答案:

没有答案