Sunday, 11 April 2021

Impossible to create a device group from android device

Since few days my app is not able anymore to create a device group from my android app. According to Firebase docs we should be able to manage device groups from server or client side. I didn't change my app from few years! So I guess something is changed without any reference in the docs. Currently my app does:

 JSONObject data = new JSONObject();
 data.put("operation", "add");
 data.put("notification_key_name", notificationKeyName);
 data.put("registration_ids", new
 JSONArray(Collections.singletonList(registrationId)));
 data.put("id_token", idToken);
 RequestBody body = RequestBody.create(MEDIA_TYPE_JSON, data.toString());
 Request oreq = new
 Request.Builder().url("https://fcm.googleapis.com/fcm/googlenotification")
  .addHeader("project_id", projectId)
  .addHeader("Content-Type", "application/json")
  .addHeader("Accept", "application/json")
  .post(body)
  .build();

where the notification key name is the user email of Google account the token is retrieved using

String idToken = GoogleAuthUtil.getToken(this, account, scope);

and the registration id is retrieved using

FirebaseMessaging.getInstance().getToken()

When the app now sends the request the result is "sender denied" but as I said I didn't change anything. In the Firebase docs however I can't find anymore any reference to the endpoint https://fcm.googleapis.com/fcm/googlenotification so is it changed anything? I tracked the web page with firebase doc and I saw that the section relative to the client android app management of device groups has been removed one year ago, on 18th March 2020.



from Impossible to create a device group from android device

No comments:

Post a Comment