0

I am trying to insert an element whenever I receive a push notif in FcmListener class using Realm now I thought that as I cannot use executetransactionasync in this class because this class does not have a looper, that's why I thought using executetransaction in an Activity class where I am showing this newly inserted element, and from FcmListener I can call this method inside Activity class whenever I received the push notification.

Now I was just thinking as executetransactionasync method is async whereas executetransaction is synchronous.

Will there be any impact on app performance or not ??

Sudhanshu Gaur
  • 7,486
  • 9
  • 47
  • 94
  • are you asking if executing code asynchronous instead of synchronous affects the performance? – Tim Jun 07 '18 at 13:26
  • @TimCastelijns Yes, also especially for the case of `Realm`. – Sudhanshu Gaur Jun 07 '18 at 13:41
  • why? Performance is not usually the deciding factor when deciding between the 2 – Tim Jun 07 '18 at 13:47
  • @TimCastelijns that's why I am asking can it be because one process is async and other is sync and because as we know when only one thread does the task it can cause delay or hang the app, that's why just a general thought that will async be better for my use case or not ?? – Sudhanshu Gaur Jun 07 '18 at 13:50
  • 1
    If the thread has no looper, it's not the UI thread, so using synchronous transaction shouldn't cause any hiccups. – EpicPandaForce Jun 07 '18 at 13:51

0 Answers0