List of usage examples for android.content IntentFilter SYSTEM_LOW_PRIORITY
int SYSTEM_LOW_PRIORITY
To view the source code for android.content IntentFilter SYSTEM_LOW_PRIORITY.
Click Source Link
From source file:org.digitalcampus.oppia.service.DownloadService.java
@Override public void onCreate() { super.onCreate(); prefs = PreferenceManager.getDefaultSharedPreferences(this); DownloadService.setInstance(this); alternativeNotifier = new BroadcastReceiver() { @Override//from ww w. ja v a 2 s . c o m public void onReceive(Context context, Intent intent) { if (!intent.hasExtra(DownloadService.SERVICE_URL) || !intent.hasExtra(DownloadService.SERVICE_ACTION)) { //If the file URL and the action are not present, we can't identify it return; } String fileUrl = intent.getStringExtra(DownloadService.SERVICE_URL); String action = intent.getStringExtra(DownloadService.SERVICE_ACTION); DownloadService.this.notifyDownloads(action, fileUrl); } }; //We register the alternative notifier for sending notifications when no other BroadcasReceiver is set IntentFilter broadcastFilter = new IntentFilter(DownloadService.BROADCAST_ACTION); broadcastFilter.setPriority(IntentFilter.SYSTEM_LOW_PRIORITY); registerReceiver(alternativeNotifier, broadcastFilter); }
From source file:com.keithandthegirl.ui.activity.GuestsDashboardFragment.java
@Override public void onResume() { Log.v(TAG, "onResume : enter"); super.onResume(); mDownloadServiceHelper = DownloadServiceHelper.getInstance(getActivity()); IntentFilter downloadFilter = new IntentFilter(DownloadServiceHelper.DOWNLOAD_RESULT); downloadFilter.setPriority(IntentFilter.SYSTEM_LOW_PRIORITY); downloadReceiver = new DownloadReceiver(); getActivity().registerReceiver(downloadReceiver, downloadFilter); if (null != mainApplication.getGuest()) { Log.v(TAG, "onResume : already downloaded guest list"); if (null != mainApplication.getGuest().getGuests() && !mainApplication.getGuest().getGuests().isEmpty()) { Log.v(TAG, "onResume : guestList has entries"); guestList = mainApplication.getGuest().getGuests(); }//from w w w . j av a2 s. co m } if (guestList.isEmpty()) { Log.v(TAG, "onResume : guestList is empty"); File root; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { root = getActivity().getExternalCacheDir(); } else { root = Environment.getExternalStorageDirectory(); } File dataDir = new File(root, DATA_DIR); dataDir.mkdirs(); File f = new File(dataDir, "Guests.xml"); if (f.exists()) { Serializer serializer = new Persister(); try { Guests guests = serializer.read(Guests.class, f); setDownloadedGuests(guests); } catch (Exception e) { Log.w(TAG, "onResume : error reading guests file"); } } else { mainApplication.setGuestSort(MainApplication.Sort.MOST_RECENT); new DownloadGuestTask().execute(MainApplication.Sort.MOST_RECENT); } } else { setupAdapter(); } Log.v(TAG, "onResume : exit"); }
From source file:com.keithandthegirl.ui.activity.EpisodesFragment.java
@TargetApi(11) @Override/*from w ww . j a va 2 s.co m*/ public void onResume() { Log.v(TAG, "onResume : enter"); super.onResume(); bindToService(); mEpisodeServiceHelper = EpisodeServiceHelper.getInstance(getActivity()); mDownloadServiceHelper = DownloadServiceHelper.getInstance(getActivity()); IntentFilter episodeFilter = new IntentFilter(EpisodeServiceHelper.EPISODE_RESULT); episodeFilter.setPriority(IntentFilter.SYSTEM_LOW_PRIORITY); episodesReceiver = new EpisodesReceiver(); getActivity().registerReceiver(episodesReceiver, episodeFilter); IntentFilter downloadFilter = new IntentFilter(DownloadServiceHelper.DOWNLOAD_RESULT); downloadReceiver = new DownloadReceiver(); getActivity().registerReceiver(downloadReceiver, downloadFilter); Cursor episodeCursor = getActivity().getContentResolver().query(EpisodeConstants.CONTENT_URI, new String[] { EpisodeConstants._ID }, null, null, null); if (episodeCursor.getCount() == 0) { loadData(); } episodeCursor.close(); if (mBound) { Log.v(TAG, "onResume : service is bound"); mMediaPlayer = mService.getMediaPlayer(); mSelectedStream = mMediaPlayer.getStreamStation(); adapter.notifyDataSetChanged(); } Log.v(TAG, "onResume : exit"); }