This is a simple question. I am adding Pushbullet support in my app by adding a Service
that extends Pushbullet's MessagingExtension
class.
Now, do I manually need to close the service inside its methods (onMessageReceived()
and onConversationDismissed()
) or does the MessagingExtension
class handle it automatically?
PB dev here. I suggest not closing/stopping the service since we are binding to it (a long lived connection). Since messaging is quite chatty, having to reconnect for each message / dismissal would be wasteful. The service is very lightweight and doesn't hold any wakelocks so the impact of maintaining the connection is very minimal. Further, if Android becomes under memory pressure, the system will clear the service as needed.