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();
}
Aggregations