I'm hoping to get some answers here, I have been searching and try almost everything. I even tried to customized my firebase sdk to fit to localization format but it doesnt work. the Push notification on my iphone shows: REMINDER_TO_BRUSH_YOUR_TEETH instead of the localization text i have on my app.
What i tried is:
"notification": {
"title": "CompanyTitle",
"body": "REMINDER_TO_BRUSH_YOUR_TEETH"
"body_loc_key": "REMINDER_TO_BRUSH_YOUR_TEETH" <----- Also tried to add that here
},
"androidConfig": {
"priority": "high",
"ttl": "120s",
"notification": {
"color": "#FFFF00",
"sound": "default"
}
},
"apnsConfig": {
"payload": {
"aps": {
"badge": 17,
"body_loc_key": "REMINDER_TO_BRUSH_YOUR_TEETH" <----- Added that
}
}
},
"token": "cwCqkaNhrE_GsNzrNXxn7V:APA91bHNLg0F7ho9tvOqosWopX9L28FnZxHNoiwxvWJDekVt9hX2RgNa6W_CNUaRe22J2iKcMc5waGHOiC57fLF1H4c-yqOtN7eTujYGWwdMAoGHJEM828-mIa1sMCrSQbZwL7MZOKJI"
}
My piece of code:
private Message.Builder getPreconfiguredMessageBuilder(PushNotificationRequest request) {
AndroidConfig androidConfig = getAndroidConfig(request.getTopic());
ApnsConfig apnsConfig = getApnsConfig(request.getTopic(), request.getBadge(), "REMINDER_TO_BRUSH_YOUR_TEETH");
Notification notification = Notification
.builder()
.setTitle(request.getTitle())
.setBody(request.getMessage())
.build();
return Message.builder()
.setApnsConfig(apnsConfig).setAndroidConfig(androidConfig).setNotification(notification);
}
private ApnsConfig getApnsConfig(String topic, int badge, String locKey) {
return ApnsConfig.builder()
.setAps(Aps.builder().setBadge(badge).setLocKey(locKey).setCategory(topic).setThreadId(topic).build()).build();
}
Thank you for your help in Advance.
This appears to be a syntax issue. Try the following:
"apnsConfig": {
"payload": {
"aps": {
"alert": {
"title": "some title",
"body": "some body"
}
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.