I have a class that uses a class instance of import io.flutter.plugin.common.MethodChannel
but now i want to pass that class instance to a Service where i can call it, but i cant get around it.
I have tried using putExtra but i cant seem to find a way to get it from the service end.
For example:
Intent playIntent = new Intent(activity.getApplicationContext(), MusicPlayerService.class);
playIntent.putExtra("activeAudioUrl", activeAudio);
playIntent.putExtra("channelInstance", channel);
activity.startService(playIntent);
Here is the service class from which i am trying to get the data:
public int onStartCommand(Intent intent, int flags, int startId) {
String activeAudio = intent.getStringExtra("activeAudioUrl");
MethodChannel methodChannel = intent.getParcelableExtra("channelInstance");
...
}