Code example for IntentFilter

Methods: registerReceiveraddActionaddDataScheme

0
        } 
 
        // ---------------------------------------------------------------------------------------------------------------------------------- 
        public void register() { 
            if (mFilter == null) {
                mFilter = new IntentFilter();
                mFilter.addAction(Intent.ACTION_MEDIA_EJECT);
                mFilter.addAction(Intent.ACTION_MEDIA_MOUNTED);
                mFilter.addDataScheme("file");
                // mFilter.setPriority(500); 
                CmClientUtil.getServiceContext().registerReceiver(this, mFilter);
            } 
        } 
 
        // ---------------------------------------------------------------------------------------------------------------------------------- 
        public void unregister() { 
            if (mFilter != null) {
                CmClientUtil.getServiceContext().unregisterReceiver(this);
                mFilter = null;
            } 
Experience pair programming with AI  Get Codota for Java