Kotlin Communicate data from Fragment and Foreground Service
I have a websocket connection within my foreground service which works great.
But now I have to pass the incoming data(messages) from foreground service to a fragment and vice versa to send data(messages) from fragment to foreground service so that the websocket can send the messages to the server via websocket.
I tried to use the interface but that doenst work. My app crashes.
This is my current code.
MainActivity
...
override fun onCreate(savedInstanceState: Bundle?) {...