|
|
@ -64,7 +64,7 @@ public class FCMNotificationStrategy implements NotificationStrategy {
|
|
|
|
if (NOTIFIER_TYPE_FCM.equals(config.getType())) {
|
|
|
|
if (NOTIFIER_TYPE_FCM.equals(config.getType())) {
|
|
|
|
Device device = FCMDataHolder.getInstance().getDeviceManagementProviderService()
|
|
|
|
Device device = FCMDataHolder.getInstance().getDeviceManagementProviderService()
|
|
|
|
.getDeviceWithTypeProperties(ctx.getDeviceId());
|
|
|
|
.getDeviceWithTypeProperties(ctx.getDeviceId());
|
|
|
|
if(getFCMToken(device.getProperties()) != null) {
|
|
|
|
if(device.getProperties() != null && getFCMToken(device.getProperties()) != null) {
|
|
|
|
this.sendWakeUpCall(ctx.getOperation().getCode(), device);
|
|
|
|
this.sendWakeUpCall(ctx.getOperation().getCode(), device);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -92,6 +92,7 @@ public class FCMNotificationStrategy implements NotificationStrategy {
|
|
|
|
|
|
|
|
|
|
|
|
private void sendWakeUpCall(String message, Device device) throws IOException,
|
|
|
|
private void sendWakeUpCall(String message, Device device) throws IOException,
|
|
|
|
PushNotificationExecutionFailedException {
|
|
|
|
PushNotificationExecutionFailedException {
|
|
|
|
|
|
|
|
if (device.getProperties() != null) {
|
|
|
|
OutputStream os = null;
|
|
|
|
OutputStream os = null;
|
|
|
|
byte[] bytes = getFCMRequest(message, getFCMToken(device.getProperties())).getBytes();
|
|
|
|
byte[] bytes = getFCMRequest(message, getFCMToken(device.getProperties())).getBytes();
|
|
|
|
|
|
|
|
|
|
|
@ -121,6 +122,7 @@ public class FCMNotificationStrategy implements NotificationStrategy {
|
|
|
|
"error code '" + status + "'");
|
|
|
|
"error code '" + status + "'");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static String getFCMRequest(String message, String registrationId) {
|
|
|
|
private static String getFCMRequest(String message, String registrationId) {
|
|
|
|
JsonObject fcmRequest = new JsonObject();
|
|
|
|
JsonObject fcmRequest = new JsonObject();
|
|
|
|