List of usage examples for android.content Intent ACTION_MEDIA_MOUNTED
String ACTION_MEDIA_MOUNTED
To view the source code for android.content Intent ACTION_MEDIA_MOUNTED.
Click Source Link
From source file:com.mobicage.rogerthat.plugins.messaging.BrandingMgr.java
public void initialize(ConfigurationProvider cfgProvider, MainService mainService) { T.UI();/*from w ww. ja v a2 s .c om*/ mCfgProvider = cfgProvider; mMainService = mainService; mContext = mainService; List<BrandedItem> copy = new ArrayList<BrandingMgr.BrandedItem>(); Collections.copy(mQueue, copy); for (BrandedItem item : copy) if (item.status != BrandedItem.STATUS_TODO) dequeue(item, false); mDownloaderThread = new HandlerThread("rogerthat_branding_worker"); mDownloaderThread.start(); Looper looper = mDownloaderThread.getLooper(); mDownloaderHandler = new Handler(looper); IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_MEDIA_MOUNTED); filter.addAction(Intent.ACTION_MEDIA_REMOVED); filter.addAction(DownloadManager.ACTION_DOWNLOAD_COMPLETE); mContext.registerReceiver(mBroadcastReceiver, filter); initStorageSettings(); mInitialized = true; mMainService.postOnBIZZHandler(new SafeRunnable() { @Override protected void safeRun() throws Exception { if (mMainService.getPluginDBUpdates(BrandingMgr.class).contains(MUST_DELETE_ATTACHMENTS_INTENT)) { synchronized (mLock) { IOUtils.deleteRecursive(getAttachmentsRootDirectory()); } mMainService.clearPluginDBUpdate(BrandingMgr.class, MUST_DELETE_ATTACHMENTS_INTENT); } } }); }
From source file:org.brandroid.openmanager.activities.OpenExplorer.java
public void handleMediaReceiver() { storageReceiver = new BroadcastReceiver() { @Override/*from w ww .j a v a 2 s .c om*/ public void onReceive(Context context, Intent intent) { String action = intent.getAction(); String data = intent.getDataString(); final String path = data.replace("file://", ""); if (action.equals(Intent.ACTION_MEDIA_MOUNTED)) handleRefreshMedia(path, true, 10); else refreshBookmarks(); } }; IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_MEDIA_MOUNTED); filter.addAction(Intent.ACTION_MEDIA_UNMOUNTED); filter.addAction(Intent.ACTION_MEDIA_SCANNER_STARTED); filter.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED); filter.addAction(Intent.ACTION_MEDIA_EJECT); filter.addDataScheme("file"); registerReceiver(storageReceiver, filter); ContentObserver mDbObserver = new ContentObserver(mHandler) { @Override public void onChange(boolean selfChange) { //rebake(false, ImageManager.isMediaScannerScanning( // getContentResolver())); } }; getContentResolver().registerContentObserver(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, true, mDbObserver); }