@Override public void onServiceConnected(ComponentName className, IBinder service) { // This is called when the connection with the service has been // established, giving us the service object we can use to // interact with the service. Because we have bound to a explicit // service that we know is running in our own process, we can // cast its IBinder to a concrete class and directly access it. mBoundService = ((DownloadService.LocalBinder) service).getService(); mBoundService.startPriorityDownload(currentSection); if (onStart != null) { Thread thread = new Thread(onStart); thread.start(); } LogHelper.info("DownloadView", "Connecting to service - button should say pause"); }
public boolean isDownloading() { if (mBoundService == null) { return false; } return mBoundService.userIsDownloading(); }
public boolean canStart(float positionFraction) { if (mBoundService == null) { return false; } return mBoundService.canStartPlayingPriorityDownload(currentSection, positionFraction); }
public void stop() { if (mBoundService != null) { mBoundService.stopPriorityDownload(currentSection); } doUnbindService(); }