0
Hello, I have the following situation, is a chat, and the user receives a message.. I want that when the app is minimized it receives an alert... The alert part I’ve done and it’s 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 receiving the message I call:
var notificacao_mensagem="mensagem a enviar";
window.JSInterface.notificacao(notificacao_mensagem);
It works, only when I click on the notification it does nothing.. I wish that by clicking on it the program that is minimized would return to appear