Hello, I have the following situation, it is a chat, and the user receives a message .. I want that when the app is minimized it receives an alert ... The part of the alert already did and it is working:
@JavascriptInterface
public void notificacao(String mensagem){
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder mBuilder = (NotificationCompat.Builder) new NotificationCompat.Builder(getApplicationContext())
.setSmallIcon(R.mipmap.app)
.setContentTitle("Nova mensagem")
.setContentText(mensagem)
.setSound(soundUri); //This sets the sound to play
notificationManager.notify(0, mBuilder.build());
}
In javascript when I receive the message I call:
var notificacao_mensagem="mensagem a enviar";
window.JSInterface.notificacao(notificacao_mensagem);
It works, but when I click on the notification it does nothing .. I wanted to click on it the program that is minimized to appear again