0

I'm kind of confused about how to do this. I have string values in the realtime database in firebase console. They change when the app is running because the code is causing the values to change, but when the application is stopped, the values won't change anymore. I want the values to change even when the application is running or not. So for example, a counter variable in the database will go up every minute forever as long as the data is there.

KENdi
  • 7,576
  • 2
  • 16
  • 31
mike-gallego
  • 706
  • 2
  • 12
  • 27

1 Answers1

1

From your explanation this seems to be an issue which can be easily solved by keeping the app running in background. For this purpose look here.

Quoting the answer from above link

A very simple answer for your problem is to use Service. It will allow you to perform variety of tasks while being in background and is your best bet for sending your location to server silently.

Read this answer for help.

Although both the answers are related to location update but they can be easily extended to fulfill your requirements.

Hint: The above quoted answers are sending the data to a server at frequent intervals. Send your data to Firebase server when the data-field is changed.

Hope this answers your query. Provide some code I might help with that too, if I get time.

Community
  • 1
  • 1
chinmish
  • 99
  • 1
  • 11