How do you make notifications keep showing up while an app is closed? I have code kind of like this:
DatabaseReference ref = database.child(username);
ref.addValueEventListener(new ValueEventListener() {
//some stuff here
}
Here, I give the user notifications whenever they get a new message or something, which works fine while they have the app open. How do I make this listener keep listening and notifying, even after the user closes the app? I've read online about making a Service or Intent yada blada, but none of that seems to work with Android 8+... any advice? I also read something about making a foreground service, but the app crashed when I tried that because I don't know anything about those.