0
I generated firebase notification without dashboard using below url: 




    try { 
      RequestQueue requestQueue = Volley.newRequestQueue(con); 
      String url = "https://fcm.googleapis.com/fcm/send"; 
      JSONObject jsonBody = new JSONObject();// 
      jsonBody.put("Title", "Android Volley Demo"); 
      jsonBody.put("Author", "BNK"); 
      final String requestBody ; 
      requestBody="{ \"data\": {\n" + 
        " \"image\": \"\",\n" + 
        " \"message\": \"appname\"\n" + 
        " \"AnotherActivity\": \"True\"\n" + 
        " },\n" + 
        " \"to\" :"+"\""+token+"\""+"\n" + 
        "}"; 
      StringRequest stringRequest = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() { 
       @Override 
       public void onResponse(String response) { 
        Log.i("VOLLEY", response); 
       } 
      }, new Response.ErrorListener() { 
       @Override 
       public void onErrorResponse(VolleyError error) { 
        Log.e("VOLLEY", error.toString()); 
       } 
      }) { 
       @Override 
       public String getBodyContentType() { 
        return "application/json; charset=utf-8"; 
       } 

       public Map<String, String> getHeaders() throws AuthFailureError 
       { 
        Map<String, String> headers = new HashMap<String, String>(); 
        headers.put("Content-Type", "application/json"); 
        headers.put("Authorization","key=server_key_here"); 

        return headers; 
       } 

       @Override 
       public byte[] getBody() throws AuthFailureError { 
        try { 
         return requestBody == null ? null : requestBody.getBytes("utf-8"); 
        } catch (UnsupportedEncodingException uee) { 
         VolleyLog.wtf("Unsupported Encoding while trying to get the bytes of %s using %s", requestBody, "utf-8"); 
         return null; 
        } 
       } 

       @Override 
       protected Response<String> parseNetworkResponse(NetworkResponse response) { 
        String responseString = ""; 
        if (response != null) { 
         responseString = String.valueOf(response.statusCode); 
         // can get more details such as response.headers 
        } 
        return Response.success(responseString, HttpHeaderParser.parseCacheHeaders(response)); 
       } 
      }; 

      requestQueue.add(stringRequest); 
     } catch (JSONException e) { 
      e.printStackTrace(); 
     } 

が表示されません通知のように notification_open notification_foreground Javaファイルを置くためのコードはありますか? 助けてくださいFirebaseイベントは、私はについてのイベントはありません成功した通知を得たが、などカント表示notification_open、notification_receive、notification_dismiss、イベントメニュー機能でfirebaseコンソール上などのイベントのみ表示 app_remove firstopen、 firebaseコンソール上

答えて

0

Firebaseコンソールの[通知]パネルから送信されたメッセージだけが自動的にアナリティクスイベントをログに記録します。 Firebase Cloud Messaging API経由で送信する(データまたは通知のいずれの)メッセージでも、アナリティクスイベントは自動的に記録されません。

関連する問題