我尝试使用FCM将通知从设备发送到另一个设备,但是在将接收通知的设备中,给我json {}

时间:2018-09-08 09:31:56

标签: android firebase google-cloud-messaging

当我从高级Rest Client发送通知到将接收通知json的设备时,它也变成{},但效果很好! 我如何跟踪此错误来解决? 我发送通知的代码

FNotification fNotification = new FNotification("Food Maker", "You have new order " + order_number);
Log.e( "onDataChange: ",serverToken.getToken()+" " +fNotification.getBody().toString()+" "+fNotification.getTitle().toString() );
Sender content = new Sender(serverToken.getToken(), fNotification);

mService.sendNotification(content)
        .enqueue(new Callback<MyResponse>() {
            @Override
            public void onResponse(Call<MyResponse> call, Response<MyResponse> response) {
                Log.e("sendNotificationOrder", "onDataChange: "+order_number);                        
                    Log.e("onResponse: ", response.body() + "");
                    if (response.body().success == 1) {
                        Toast.makeText(Cart.this, "Thanks you, order place", Toast.LENGTH_SHORT).show();
                        finish();

                    } else {
                        Toast.makeText(Cart.this, "Failed!!", Toast.LENGTH_SHORT).show();
                    }
            }

0 个答案:

没有答案