-1

I hope all of you would be fine and doing good. I have bunch of sensors data in firebase database and i want to read specific data in my app. Like read data after 2 minutes or some specific time. Can anyone please help me out ??? i am new to android app development so detailed answers are welcome...

4 Answers4

0

yes, you can achieve using below code.

new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                // call function
            }
        },1 * 60 * 1000);
VIISHRUT MAVANII
  • 11,410
  • 7
  • 34
  • 49
0

Use the new WorkManager library from Android JetPack. You will need to:

  • Create Worker by extending androidx.work.Worker which will read data from firebase database.

  • Create a OneTimeWorkRequest with an initial delay of two seconds and launch your worker.

You can also schedule Work periodically. Refer to WorkManager documentation.

farhanjk
  • 1,652
  • 16
  • 17
0

Show Process dialog until you got response from Firebase Listener.

or

You should use Progress Dialog.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Mayur Dabhi
  • 3,607
  • 2
  • 14
  • 25
0

Use Handler rather than Thread.sleep().

This might be helpful : Set delay in Android

lambda
  • 990
  • 1
  • 10
  • 29