-1
When the App is open the icon appears normal, now when the app is not open only a circle appears instead of the icon. I have a system in Swing that when the user does a certain action is sent a notification.
Code that stays in the system in Swing
public void enviaNotificacaoDenunciaFcm(String tkn, String corpo) {
try {
URL url = new URL("https://fcm.googleapis.com/fcm/send");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setUseCaches(false);
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "key=chave do fcm");
conn.setRequestProperty("Content-Type", "application/json");
JSONObject json = new JSONObject();
json.put("to", tkn);
JSONObject info = new JSONObject();
info.put("title", "Secretaria do Meio Ambiente"); // Notification title
info.put("body", corpo); // Notification body
info.put("color", "blue");
json.put("notification", info);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(json.toString());
wr.flush();
conn.getInputStream();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
JOptionPane.showMessageDialog(this, "Erro ao enviar notificação!\n" + e, "Erro", JOptionPane.ERROR_MESSAGE);
atualizaTabela();
desabilitaBotoes();
desabilitaCampos();
limpaCampos();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
JOptionPane.showMessageDialog(this, "Erro ao enviar notificação!\n" + e, "Erro", JOptionPane.ERROR_MESSAGE);
}
// return null;
}
I don’t know the reason for the negative since I explained everything well.
– jallisson jallis oliveira band