/** * Hook method called when the DownloadActivity becomes completely hidden to unbind the Activity * from the Services. */ @Override public void onStop() { super.onStop(); // Unbind the Sync/Async Services if they are bound. Use // mBoundSync/mBoundAsync if (mDownloadCall != null) unbindService(mServiceConnectionSync); if (mDownloadRequest != null) unbindService(mServiceConnectionAsync); }
/** * Hook method called when the DownloadActivity becomes visible to bind the Activity to the * Services. */ @Override public void onStart() { super.onStart(); // Bind this activity to the DownloadBoundService* Services if // they aren't already bound Use mBoundSync/mBoundAsync if (mDownloadCall == null) bindService( DownloadBoundServiceSync.makeIntent(this), mServiceConnectionSync, BIND_AUTO_CREATE); if (mDownloadRequest == null) bindService( DownloadBoundServiceAsync.makeIntent(this), mServiceConnectionAsync, BIND_AUTO_CREATE); }