List of usage examples for android.app DownloadManager getRecommendedMaxBytesOverMobile
public static Long getRecommendedMaxBytesOverMobile(Context context)
From source file:com.github.jthuraisamy.yellowusage.ui.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); Log.d(TAG, "isMobileDataEnabled = " + isMobileDataEnabled(connectivityManager)); Log.d(TAG, "isMobileDataConnected = " + isMobileDataConnected(telephonyManager)); Log.d(TAG, "isWifiConnected = " + isWifiConnected(wifiManager)); switch (id) { case R.id.action_refresh: Log.i(TAG, "taskQueue = " + String.valueOf(taskQueue.size())); Log.i(TAG, "ongoingTasks = " + String.valueOf(ongoingTasks)); // Remind user to disable airplane mode if it's on. if (isAirplaneModeOn(this)) { Toast.makeText(this, R.string.disable_airplane_mode, Toast.LENGTH_LONG).show(); break; }//from w w w . j ava 2 s .c o m // Remind user to enable mobile data if it's disabled. if (!isMobileDataEnabled(connectivityManager)) { Toast.makeText(this, R.string.enable_mobile_data, Toast.LENGTH_LONG).show(); break; } if (!taskQueue.isEmpty()) { // Finish any already queued tasks. runTasks(); } else if (ongoingTasks == 0) { // Add tasks to queue since the queue is empty and there are no ongoing tasks. taskQueue.add(new DataUsageTask()); taskQueue.add(new VoiceUsageTask()); taskQueue.add(new MessagingUsageTask()); runTasks(); } else { // Wait for tasks to complete. Toast.makeText(this, R.string.wait_for_tasks, Toast.LENGTH_LONG).show(); } break; case R.id.action_settings: Intent settingsIntent = new Intent(this, SettingsActivity.class); startActivity(settingsIntent); break; case R.id.action_about: final Long recommendedBytes = DownloadManager.getRecommendedMaxBytesOverMobile(this); final Long maximumBytes = DownloadManager.getMaxBytesOverMobile(this); Log.i(TAG, "recommendedBytes = " + recommendedBytes); Log.i(TAG, "maximumBytes = " + maximumBytes); break; case R.id.action_exit: this.finish(); break; } return super.onOptionsItemSelected(item); }