You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can send push notifications to various recipient types by providing one of the following recipient keys:
102
102
103
-
104
103
|Key|Type|Description|
105
104
|---|---|---|
106
105
|to|String|A single [registration token](https://developers.google.com/cloud-messaging/android/client#sample-register), [notification key](https://developers.google.com/cloud-messaging/notifications), or [topic](https://developers.google.com/cloud-messaging/topic-messaging).
@@ -117,21 +116,13 @@ This is due to [a restriction](http://developer.android.com/training/cloudsync/g
117
116
## Notification usage
118
117
119
118
```js
120
-
121
-
var message =newgcm.Message();
122
-
123
-
// Add notification payload as key value
124
-
message.addNotification('title', 'Alert!!!');
125
-
message.addNotification('body', 'Abnormal data access');
126
-
message.addNotification('icon', 'ic_launcher');
127
-
128
-
// as object
129
-
message.addNotification({
130
-
title:'Alert!!!',
131
-
body:'Abnormal data access',
132
-
icon:'ic_launcher'
133
-
});
134
-
119
+
var message = {
120
+
notification: {
121
+
title:'Alert!!!',
122
+
body:'Abnormal data access',
123
+
icon:'ic_launcher'
124
+
}
125
+
};
135
126
```
136
127
137
128
### Notification payload option table
@@ -164,13 +155,13 @@ var requestOptions = {
164
155
timeout:5000
165
156
};
166
157
167
-
// Set up the sender with your API key and request options
0 commit comments