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...
Asked
Active
Viewed 512 times
-1
-
Have you tried looking into AlarmManager or Hanlder thread – yfdgvf asdasdas Apr 04 '19 at 02:40
-
Use handler with delay. – santosh kumar Apr 04 '19 at 04:27
4 Answers
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 extendingandroidx.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