Endroid Google Cloud Messaging

1.2.12 2016-01-17 16:05 UTC

This package is auto-updated.

Last update: 2024-09-09 22:11:03 UTC


README

endroid 提供

Build Status Latest Stable Version Total Downloads

Google Cloud Messaging 是一项帮助开发者将数据从服务器发送到其 Android 设备上 Android 应用的服务。有关更多信息,请参阅 Google GCM

当请求的消息目标为 1000+ 注册 ID 时,请求将自动分块并行发送,以规避 Google 施加的限制。因此,使用此类时,您无需担心此限制。

<?php

use Endroid\Gcm\Client;

$client = new Client($apiKey);

// Registration ID's of devices to target
$registrationIds = array(
    ...
);

$data = array(
    'title' => 'Message title',
    'message' => 'Message body',
);

$success = $client->send($data, $registrationIds);

如果发生错误,或者您只想检查 GCM 服务器返回的响应对象,您可以使用 getResponses() 方法检索这些对象。

Symfony

您可以使用 EndroidGcmBundle 在您的 Symfony 应用程序中启用此服务。

版本控制

版本号遵循 MAJOR.MINOR.PATCH 方案。向后兼容的更改将尽量保持最小,但请注意,这些更改可能发生。在生产环境中锁定依赖项,并在升级时测试您的代码。

许可证

此包采用 MIT 许可证。有关完整的版权和许可信息,请查看与源代码一起分发的 LICENSE 文件。