0

I have developed an app in Android studio and now I want to deploy a scheduled firebase function. My app contains various users and each user have a node named "clicksRemain", I want that after every 24 hours the value of this node may be reset to 0. Please have a look at the attached snapshot of my real-time database. enter image description here

I I have written the following function and it's not working. Please help. Note: I am using firebase real time database.

const functions = require("firebase-functions");
const admin = require('firebase-admin');
admin.initializeApp();

const database = admin.database();

exports.scheduledFunction = functions.pubsub.schedule('* * * * *').onRun((context) => {
  
    database.ref("Users/clicksRemain").update({"Users": admin.database.Timestamp.now()});
    return   console.log('Successfull timer update');;
  });
Doug Stevenson
  • 268,359
  • 30
  • 341
  • 380
Gum Naam
  • 124
  • 9

0 Answers0