Search in sources :

Example 1 with MusicPlaybackService

use of com.andrew.apollo.MusicPlaybackService in project frostwire by frostwire.

the class MusicUtils method requestMusicPlaybackServiceShutdown.

public static void requestMusicPlaybackServiceShutdown(Context context) {
    if (context == null) {
        LOG.warn("requestMusicPlaybackServiceShutdown() aborted. context is null.");
        return;
    }
    if (!SystemUtils.isServiceRunning(context, MusicPlaybackService.class)) {
        LOG.info("requestMusicPlaybackServiceShutdown() aborted. MusicPlaybackService has already shutdown.");
        return;
    }
    try {
        final Intent shutdownIntent = new Intent(context, MusicPlaybackService.class);
        shutdownIntent.setAction(MusicPlaybackService.SHUTDOWN_ACTION);
        shutdownIntent.putExtra("force", true);
        LOG.info("MusicUtils.requestMusicPlaybackServiceShutdown() -> sending shut down intent now");
        LOG.info("MusicUtils.requestMusicPlaybackServiceShutdown() -> " + shutdownIntent);
        context.startService(shutdownIntent);
    } catch (Throwable t) {
        t.printStackTrace();
    }
}
Also used : Intent(android.content.Intent) MusicPlaybackService(com.andrew.apollo.MusicPlaybackService)

Aggregations

Intent (android.content.Intent)1 MusicPlaybackService (com.andrew.apollo.MusicPlaybackService)1