Please provide the following:
- SDK Version: 44
- Platforms(Android/iOS/web/all): Android & iOS
I’m using expo-push-sdk:0.1.4
to send push notifications from a Java backend. Locally, I’m using an expo-dev-client
rather than Expo Go.
All is good in production and locally on iOS. But when sending to an ExponentPushToken
from an Android device running expo-dev-client
, I get this error PushTicket
:
{
"data": {
"status": "ERROR",
"id": "37aff728-72e9-4d52-8c05-ac49f8254d28",
"message": "There was an unknown error with the FCM server. See this error's details for more information.",
"details": {
"error": null
}
},
},
"errors": null
}
Has anybody seen this before? Any ideas on what it could be?
I use different google-services.json
for development and production, but I can’t see anything wrong with the development one.
The code, for what it’s worth:
@Override
public void sendMobilePushMessage(MobilePushNotificationDTO message) throws IOException {
ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
List<Message> messages = new ArrayList<>();
messages.add(expoMessage(message));
sendMobilePushMessages(message.getTo(), messages);
executorService.schedule(() -> checkMobilePushReceipts(message.getTo()), 15, TimeUnit.MINUTES);
}
private Message expoMessage(MobilePushNotificationDTO message) {
return new Message.Builder()
.to(message.getTo())
.title(message.getTitle())
.body(message.getBody())
.channelId(message.getChannelId())
.badge(message.getBadge())
.data(message.getData(
.build();
}
private void sendMobilePushMessages(String token, List<Message> messages) throws IOException {
List<List<Message>> chunks = ExpoPushClient.chunkItems(messages);
for (List<Message> chunk : chunks) {
try {
PushTicketResponse response = ExpoPushClient.sendPushNotifications(chunk);
if (response != null) {
List<ExpoError> errors = response.getErrors();
if (errors != null) {
// Handle errors
}
// Handle individual push ticket errors or save push ticket to db
}
}
}
}