3

I need to call a method residing in a FireBaseMessaging service from my main activity. I have tried to Bind the service (How to call methods of a Service from activity?) and also use BroadcastRecievers (Android call method in Service from Activity) but since both onBind and onStartCommand are declared final in FireBaseMessagingService class and therefore cannot be overrided my efforts werent successful. How can this be achieved?.

Thanks for your attention.

Community
  • 1
  • 1
saiedmomen
  • 1,401
  • 16
  • 33
  • 1
    Please explain more what you are trying to do. also, methods in FirebaseMessaginService are supposed to be overridden, not called from other components. – Diego Giorgini Feb 06 '17 at 00:26
  • I'm trying to sync some data. When onMessagerecieved is fired I fetch the refreshed data from net. I have implemented network calling methods in Firebasemessaging service. I also like to be able to call these methods from UI thread(like a manual update button). I tried putting these network calls in an Asynctask but apparently you only can call Asynctask from main thread. This scenario must be fairly common but I everything I tried proved problematic. – saiedmomen Feb 06 '17 at 22:11

0 Answers0