Search in sources :

Example 1 with CastManager

use of com.simplecity.amp_library.cast.CastManager in project Shuttle by timusus.

the class MusicService method onCreate.

@SuppressLint("InlinedApi")
@Override
public void onCreate() {
    AndroidInjection.inject(this);
    super.onCreate();
    queueManager = new QueueManager(musicServiceCallbacks, songsRepository, playbackSettingsManager, settingsManager);
    playbackManager = new PlaybackManager(this, queueManager, playbackSettingsManager, songsRepository, albumsRepository, albumArtistsRepository, genresRepository, playlistsRepository, musicServiceCallbacks, settingsManager);
    scrobbleManager = new ScrobbleManager(playbackSettingsManager);
    mPackageValidator = new PackageValidator(this);
    setSessionToken(playbackManager.getMediaSessionToken());
    if (CastManager.isCastAvailable(this, settingsManager)) {
        castManager = new CastManager(this, playbackManager);
    }
    bluetoothManager = new BluetoothManager(playbackManager, analyticsManager, musicServiceCallbacks, settingsManager);
    headsetManager = new HeadsetManager(playbackManager, playbackSettingsManager);
    notificationHelper = new MusicNotificationHelper(this, analyticsManager);
    notificationStateHandler = new NotificationStateHandler(this);
    headsetManager.registerHeadsetPlugReceiver(this);
    bluetoothManager.registerBluetoothReceiver(this);
    bluetoothManager.registerA2dpServiceListener(this);
    registerExternalStorageListener();
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(ServiceCommand.COMMAND);
    intentFilter.addAction(ServiceCommand.TOGGLE_PLAYBACK);
    intentFilter.addAction(ServiceCommand.PAUSE);
    intentFilter.addAction(ServiceCommand.NEXT);
    intentFilter.addAction(ServiceCommand.PREV);
    intentFilter.addAction(ServiceCommand.STOP);
    intentFilter.addAction(ServiceCommand.SHUFFLE);
    intentFilter.addAction(ServiceCommand.REPEAT);
    intentFilter.addAction(ExternalIntents.PLAY_STATUS_REQUEST);
    registerReceiver(intentReceiver, intentFilter);
    // Initialize the delayed shutdown intent
    Intent shutdownIntent = new Intent(this, MusicService.class);
    shutdownIntent.setAction(ServiceCommand.SHUTDOWN);
    alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
    this.shutdownIntent = PendingIntent.getService(this, 0, shutdownIntent, 0);
    analyticsManager.dropBreadcrumb(TAG, "onCreate(), scheduling delayed shutdown");
    scheduleDelayedShutdown();
    playbackManager.reloadQueue();
}
Also used : IntentFilter(android.content.IntentFilter) PackageValidator(com.simplecity.amp_library.androidauto.PackageValidator) CastManager(com.simplecity.amp_library.cast.CastManager) MusicNotificationHelper(com.simplecity.amp_library.notifications.MusicNotificationHelper) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 PendingIntent (android.app.PendingIntent)1 Intent (android.content.Intent)1 IntentFilter (android.content.IntentFilter)1 PackageValidator (com.simplecity.amp_library.androidauto.PackageValidator)1 CastManager (com.simplecity.amp_library.cast.CastManager)1 MusicNotificationHelper (com.simplecity.amp_library.notifications.MusicNotificationHelper)1