SendSimplePushNotification
Sends a simple push notification based on the passed in message.
Service | Operation |
---|---|
pushNotification | SEND_SIMPLE |
Method Parameters
Parameter | Description |
---|---|
toProfileId | The profileId of the user to receive the notification. |
message | The content of the message. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string toProfileId = "profile1";
string message = "Hello World";
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};
_bc.PushNotificationService.SendSimplePushNotification(toProfileId, message, successCallback, failureCallback);
const char *toProfileId = "profile1";
const char *message = "Hello World";
_bc->getPushNotificationService()->sendSimplePushNotification(toProfileId, message, this);
NSString *toProfileId = @"profile1";
NSString *message = @"Hello World";
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc pushNotificationService] sendSimplePushNotification:toProfileId
message:message
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String toProfileId = "profile1";
String message = "Hello World";
this; // implements IServerCallback
_bc.getPushNotificationService().sendSimplePushNotification(toProfileId, message, this);
public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
System.out.print(String.format("Failed | %d %d %s", statusCode, reasonCode, jsonError.toString()));
}
var toProfileId = "profile1";
var message = "Hello World";
_bc.pushNotification.sendSimplePushNotification(toProfileId, message, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var toProfileId = "profile1";
var message = "Hello World";
ServerResponse result = await _bc.pushNotificationService.sendSimplePushNotification(profileId:toProfileId, message:message);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var toProfileId = "profile1";
var message = "Hello World";
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();
var postResult = pushNotificationProxy.sendSimplePushNotification(toProfileId, message);
if (postResult.status == 200) {
// Success!
}
{
"service": "pushNotification",
"operation": "SEND_SIMPLE",
"data": {
"toProfileId": "profile1",
"message": "Hello World"
}
}
JSON Response
{
"status": 200,
"data": null
}