I am currently developing an application and I have created data on Firebase Realtime Database. I am not sure how after x amount of time I can delete specific data in Firebase RelatimeDatabase. My first approach was to use the java.util.TimerTask() but then when I was testing it I found out this is only when the application is running. I would need something that works in the background constantly. Any advice or guidance would be greatly appreciated.
the attempt I made so far was simply calling a log statement to see if it executes every x amount of time but then I realised I would need this to run constantly like a background service.
new java.util.Timer().schedule(
new java.util.TimerTask() {
@Override
public void run() {
resetDatabase();
}
},
10000
);