5

I'm new to realm and trying to delete the entire realm database after logout. I want to check if any realm instances is running or not before deleting the database.

Dedeepthika
  • 305
  • 4
  • 15

1 Answers1

8

You can use Realm.getGlobalInstanceCount(config) to see how many threads there are open Realms on,

and you can use Realm.getLocalInstanceCount(config) to see how many local Realm instances are there open on this current thread.

If globalInstance == 0 then no Realm is open on any thread.

EpicPandaForce
  • 79,669
  • 27
  • 256
  • 428