I am using following code to send the FCM notification from server to device :
String fcmServerKey = externalConfig.getFcmServerKey();
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(HTTPS_FCM_GOOGLEAPIS_COM_FCM_SEND);
httpPost.setEntity(new StringEntity(message, ContentType.create("application/json")));
httpPost.setHeader("Authorization", "key=" + fcmServerKey);
CloseableHttpResponse closeableHttpResponse= httpclient.execute(httpPost);
In above code when I get the response object closeableHttpResponse
, how can I detect wether the fcm token used to send this request is expired or not registered ?
When from firebase application dashboard I try sending the notification to a device using its fcm token and After application is removed from device, I see Failed
on firebase dashboard, on hovering cursor on Failed
I see Unregistered registration token
.
How can I detect above error situation of Unregistered registration token
from api response object closeableHttpResponse
?