Search in sources :

Example 1 with PlaybackService

use of de.danoeh.antennapod.core.service.playback.PlaybackService in project AntennaPod by AntennaPod.

the class PlaybackController method bindToService.

/**
 * Tries to establish a connection to the PlaybackService. If it isn't
 * running, the PlaybackService will be started with the last played media
 * as the arguments of the launch intent.
 */
private void bindToService() {
    Log.d(TAG, "Trying to connect to service");
    if (!PlaybackService.isRunning) {
        throw new IllegalStateException("Trying to bind but service is not running");
    }
    boolean bound = activity.bindService(new Intent(activity, PlaybackService.class), mConnection, 0);
    Log.d(TAG, "Result for service binding: " + bound);
}
Also used : Intent(android.content.Intent) PlaybackService(de.danoeh.antennapod.core.service.playback.PlaybackService)

Aggregations

Intent (android.content.Intent)1 PlaybackService (de.danoeh.antennapod.core.service.playback.PlaybackService)1