请求firebase不起作用,errorCode 400 badRequest

时间:2018-03-01 17:35:13

标签: firebase google-api google-cloud-messaging firebase-cloud-messaging

我正在尝试使用Firebase发送通知。

我在这里阅读了文档:https://firebase.google.com/docs/cloud-messaging/js/device-group?authuser=3#managing-device-groups-on-the-app-server,but我得到了badRequest响应。

我的请求HTTP GET在这里获取notification_key:

{
  method  : 'GET',
  uri     : https://android.googleapis.com/gcm/notification?notification_key_name=<notification_keyname>,
  json    : 'true',
  headers : {
    Authorization  : key=<API_KEY>,
    'Content-Type' : 'application/json',
    project_id     : senderId,
  },
}

此请求有什么问题?

1 个答案:

答案 0 :(得分:0)

try {
                        MobileServiceSyncContext syncContext = mClient.getSyncContext();
                        syncContext.push().get();

                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    } catch (ExecutionException e) {
                        e.printStackTrace();
                    } catch (MobileServiceConflictException e) {

                    }

我可以看到两个不必要的逗号({ method : 'GET', uri : https://android.googleapis.com/gcm/notification?notification_key_name=<notification_keyname>, json : 'true', headers : { Authorization : key=<API_KEY>, 'Content-Type' : 'application/json', project_id : senderId, }, } ):

,
相关问题