In my FirebaseMessagingService, I want to use interface because whenever I get notification, I want to do some operation in my activity. So is it possible to use Interface in FirebaseMessagingService?
Asked
Active
Viewed 859 times
0
-
There is no way to trigger an operation on an Activity when something happens at a Service. That's because Services are designed to work in the background. Your activity might not be visible when the service triggers the operation and that would generate an error. May I ask: What kind of operation are you trying to do in your activity when a new notification arrives? – Rosário Pereira Fernandes May 15 '18 at 19:17
-
Also: Should this operation happen only when the activity is visible? And not happen when the activity is invisible? – Rosário Pereira Fernandes May 15 '18 at 19:18
1 Answers
0
Probably thats the only way. Create a Broadcast receiver and feel free to comunicate with your notifications

rosinek
- 23
- 3