java - 如何使用 GCM 使用 notification_key?

标签 java php android google-cloud-messaging

是否有任何 GCM 客户端和服务器 php 示例描述了 notification_key 的使用。因为我的应用程序需要为具有多个设备的用户推送通知。但找不到任何合适的示例或方法来实现此 http://developer.android.com/google/gcm/notifications.html .

谢谢,请帮忙。

最佳答案

这个 PHP 库有一个通过通知键发送的选项:

https://github.com/CoreProc/gcm-php

$gcmClient = new GcmClient('your-gcm-api-key-here');
$message = new Message($gcmClient);
$message->setNotificationKey('xxxxxxxxxx');
$message->setData([
    'title' => 'Sample Push Notification',
    'message' => 'This is a test push notification using Google Cloud Messaging'
]);
$message->send()

关于java - 如何使用 GCM 使用 notification_key?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22042278/

相关文章:

java - 如何在此代码部分中的 ajax 成功调用中显示隐藏的 div

php - 如何从 codeigniter 的 URL 中删除 Controller 名称?

java - 将 HashMap 的 ArrayList 转换为 JSON String

php - 使用部分匹配的关键字搜索/查询 mysql 数据库

android - 使用应用内购买获得任意捐赠值(value)?

android - 如何在android中检索选定文本的BackgroundColorSpan

java - 解析 unix,UTC android

java - 如何使用类中的参数返回特定方法的名称

java - 在 JPanel 上短时间内画很多画

php - SELECT MAX MySQL 查询 - 异常结果