List of usage examples for android.util Log ERROR
int ERROR
To view the source code for android.util Log ERROR.
Click Source Link
From source file:com.salesforce.marketingcloud.android.demoapp.LearningAppApplication.java
/** * The onCreate() method initialize your app. * <p/>/*from w ww . j a v a 2 s . c o m*/ * In {@link MarketingCloudConfig.Builder} you must set several parameters: * <ul> * <li> * AppId and AccessToken: these values are taken from the Marketing Cloud definition for your app. * </li> * <li> * SenderID for the push notifications: this value is taken from the Google API console. * </li> * <li> * You also set whether you enable LocationManager, CloudPages, and Analytics. * </li> * </ul> **/ @Override public void onCreate() { super.onCreate(); sharedPreferences = getSharedPreferences("AndroidLearningApp", Context.MODE_PRIVATE); /** Register to receive push notifications. */ MarketingCloudSdk.setLogLevel(BuildConfig.DEBUG ? Log.VERBOSE : Log.ERROR); MarketingCloudSdk.setLogListener(new MCLogListener.AndroidLogListener()); MarketingCloudSdk.init(this, MarketingCloudConfig.builder() // // PROVIDE YOUR APPLICATION'S VALUES .setApplicationId() // ENTER YOUR MARKETING CLOUD APPLICATION ID HERE .setAccessToken() // ENTER YOUR MARKETING CLOUD ACCESS TOKEN HERE .setSenderId() // ENTER YOUR GOOGLE SENDER ID HERE // ENABLE MARKETING CLOUD FEATURES .setAnalyticsEnabled(ANALYTICS_ENABLED).setPiAnalyticsEnabled(PI_ENABLED) .setInboxEnabled(INBOX_ENABLED).setGeofencingEnabled(LOCATION_ENABLED) .setProximityEnabled(PROXIMITY_ENABLED) .setNotificationCustomizationOptions( NotificationCustomizationOptions.create(R.drawable.ic_stat_app_logo_transparent)) .build(this), this); MarketingCloudSdk.requestSdk(new MarketingCloudSdk.WhenReadyListener() { @Override public void ready(MarketingCloudSdk sdk) { sdk.getRegistrationManager().registerForRegistrationEvents(LearningAppApplication.this); sdk.getRegionMessageManager().registerGeofenceMessageResponseListener(LearningAppApplication.this); sdk.getRegionMessageManager().registerProximityMessageResponseListener(LearningAppApplication.this); } }); }
From source file:org.fs.core.AbstractActivity.java
protected void log(Throwable error) { StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); error.printStackTrace(printWriter);// w w w.j a v a 2 s . com log(Log.ERROR, stringWriter.toString()); }
From source file:org.jorge.lolin1.ui.activities.DrawerLayoutFragmentActivity.java
@Override public void onNavigationDrawerItemSelected(int position) { if (!navigatedItemsStack.isEmpty() && position == getLastSelectedNavDrawerIndex()) { //We don't want to perform an unnecessary Activity reload //noinspection UnnecessaryReturnStatement return;/* ww w. j a v a 2 s.co m*/ } else { navigatedItemsStack.push(position); } Runnable task; switch (position) { case 0: task = new Runnable() { @Override public void run() { startActivity(new Intent(getApplicationContext(), NewsReaderActivity.class)); } }; break; case 1: task = new Runnable() { @Override public void run() { startActivity(new Intent(getApplicationContext(), JungleTimersActivity.class)); } }; break; case 2: task = new Runnable() { @Override public void run() { startActivity(new Intent(getApplicationContext(), ChampionListActivity.class)); } }; break; case 3: task = new Runnable() { @Override public void run() { startActivity(new Intent(getApplicationContext(), SurrReaderActivity.class)); } }; break; case 4: task = new Runnable() { @Override public void run() { startActivity(new Intent(getApplicationContext(), ChatOverviewActivity.class)); } }; break; default: Crashlytics.log(Log.ERROR, "debug", "Should never happen - Selected index - " + position); task = null; } if (task != null) { ScheduledExecutorService newActivityExecutor = Executors.newSingleThreadScheduledExecutor(); newActivityExecutor.schedule(task, 0, TimeUnit.MILLISECONDS); } }
From source file:com.scvngr.levelup.core.util.LogManager.java
/** * Log a message./* w w w. j a v a 2 s . c o m*/ * * @param msg message to log. This message is expected to be a format string if varargs are * passed in. * @param args optional arguments to be formatted into {@code msg}. */ public static void e(@NonNull final String msg, @Nullable final Object... args) { logMessage(Log.ERROR, msg, args, null); }
From source file:com.google.android.apps.forscience.whistlepunk.metadata.EditTriggerFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSensorId = getArguments().getString(ARG_SENSOR_ID); mExperimentId = getArguments().getString(ARG_EXPERIMENT_ID); try {//from w w w . ja va 2s . co m mSensorLayout = GoosciSensorLayout.SensorLayout .parseFrom(getArguments().getByteArray(ARG_SENSOR_LAYOUT)); } catch (InvalidProtocolBufferNanoException e) { if (Log.isLoggable(TAG, Log.ERROR)) { Log.e(TAG, "Error parsing the SensorLayout", e); } mSensorLayout = RecordFragment.defaultLayout(); } mSensorLayoutPosition = getArguments().getInt(ARG_LAYOUT_POSITION); String triggerId = getArguments().getString(ARG_TRIGGER_ID, ""); if (!TextUtils.isEmpty(triggerId)) { try { mTriggerToEdit = new SensorTrigger(triggerId, mSensorId, 0, GoosciSensorTriggerInformation.TriggerInformation .parseFrom(getArguments().getByteArray(ARG_TRIGGER_INFO))); } catch (InvalidProtocolBufferNanoException e) { if (Log.isLoggable(TAG, Log.ERROR)) { Log.e(TAG, "Error parsing the SensorTrigger", e); } // We will make a new trigger, since we could not parse the one to edit. mTriggerToEdit = null; } } }
From source file:com.github.mguidi.asyncop.AsyncOpHelper.java
/** * @param action action// w ww.j ava 2 s. com * @param args arguments * @return id of the request */ public int execute(String action, Bundle args) { int idRequest = mNextIdRequest++; mPendingRequests.add(idRequest); mMapPendingRequestsAction.putString(String.valueOf(idRequest), action); Intent intent = new Intent(Constants.ACTION_ASYNCOP); intent.putExtra(Constants.ARGS_ACTION, action); intent.putExtra(Constants.ARGS_ID_HELPER, mIdHelper); intent.putExtra(Constants.ARGS_ID_REQUEST, idRequest); intent.putExtra(Constants.ARGS_ARGS, args); if (!LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent)) { if (Log.isLoggable(Constants.LOG_TAG, Log.ERROR)) { Log.e(Constants.LOG_TAG, "asyncop manager not initialize"); } throw new RuntimeException("asyncop manager not initialize"); } return idRequest; }
From source file:com.scvngr.levelup.core.util.LogManager.java
/** * Log a message.//from w w w . j a v a 2s .c om * * @param msg message to log. * @param err an exception that occurred, whose trace will be printed with the log message. */ public static void e(@NonNull final String msg, @Nullable final Throwable err) { logMessage(Log.ERROR, msg, null, err); }
From source file:com.google.android.gcm.demo.logic.GcmServerSideSender.java
/** * Send a downstream message via HTTP plain text. * * @param destination the registration id of the recipient app. * @param message the message to be sent * @throws IOException//w w w.j a v a 2 s. c o m */ public void sendHttpPlaintextDownstreamMessage(String destination, Message message) throws IOException { StringBuilder request = new StringBuilder(); request.append(PARAM_TO).append('=').append(destination); addOptParameter(request, PARAM_DELAY_WHILE_IDLE, message.isDelayWhileIdle()); addOptParameter(request, PARAM_DRY_RUN, message.isDryRun()); addOptParameter(request, PARAM_COLLAPSE_KEY, message.getCollapseKey()); addOptParameter(request, PARAM_RESTRICTED_PACKAGE_NAME, message.getRestrictedPackageName()); addOptParameter(request, PARAM_TIME_TO_LIVE, message.getTimeToLive()); for (Map.Entry<String, String> entry : message.getData().entrySet()) { if (entry.getKey() != null && entry.getValue() != null) { String prefixedKey = PARAM_PLAINTEXT_PAYLOAD_PREFIX + entry.getKey(); addOptParameter(request, prefixedKey, URLEncoder.encode(entry.getValue(), UTF8)); } } HttpRequest httpRequest = new HttpRequest(); httpRequest.setHeader(HEADER_CONTENT_TYPE, CONTENT_TYPE_FORM_ENCODED); httpRequest.setHeader(HEADER_AUTHORIZATION, "key=" + key); httpRequest.doPost(GCM_SEND_ENDPOINT, request.toString()); if (httpRequest.getResponseCode() != 200) { throw new IOException("Invalid request." + "\nStatus: " + httpRequest.getResponseCode() + "\nResponse: " + httpRequest.getResponseBody()); } String[] lines = httpRequest.getResponseBody().split("\n"); if (lines.length == 0 || lines[0].equals("")) { throw new IOException("Received empty response from GCM service."); } String[] firstLineValues = lines[0].split("="); if (firstLineValues.length != 2) { throw new IOException("Invalid response from GCM: " + httpRequest.getResponseBody()); } switch (firstLineValues[0]) { case RESPONSE_PLAINTEXT_MESSAGE_ID: logger.log(Log.INFO, "Message sent.\nid: " + firstLineValues[1]); // check for canonical registration id if (lines.length > 1) { // If the response includes a 2nd line we expect it to be the CANONICAL REG ID String[] secondLineValues = lines[1].split("="); if (secondLineValues.length == 2 && secondLineValues[0].equals(RESPONSE_PLAINTEXT_CANONICAL_REG_ID)) { logger.log(Log.INFO, "Message sent: canonical registration id = " + secondLineValues[1]); } else { logger.log(Log.ERROR, "Invalid response from GCM." + "\nResponse: " + httpRequest.getResponseBody()); } } break; case RESPONSE_PLAINTEXT_ERROR: logger.log(Log.ERROR, "Message failed.\nError: " + firstLineValues[1]); break; default: logger.log(Log.ERROR, "Invalid response from GCM." + "\nResponse: " + httpRequest.getResponseBody()); break; } }
From source file:com.googlecode.eyesfree.brailleback.FocusFinder.java
public static AccessibilityNodeInfoCompat getFocusedNode(AccessibilityService service, boolean fallbackOnRoot) { AccessibilityNodeInfo root = service.getRootInActiveWindow(); AccessibilityNodeInfo focused = null; try {/*from ww w.java2s . c om*/ AccessibilityNodeInfo ret = null; if (root != null) { focused = root.findFocus(AccessibilityNodeInfo.FOCUS_ACCESSIBILITY); if (focused != null && focused.isVisibleToUser()) { ret = focused; focused = null; } else if (fallbackOnRoot) { ret = root; root = null; } } else { LogUtils.log(service, Log.ERROR, "No current window root"); } if (ret != null) { return new AccessibilityNodeInfoCompat(ret); } } finally { if (root != null) { root.recycle(); } if (focused != null) { focused.recycle(); } } return null; }
From source file:com.google.android.gcm.demo.model.TaskTracker.java
/** * Execute this task, reporting any errors if this was an invalid execution. */// w w w . j a va 2s . c o m public void execute(LoggingService.Logger logger) { final long elapsedNowSecs = SystemClock.elapsedRealtime() / 1000; if (!cancelled) { if (executed && period == 0) { logger.log(Log.ERROR, "Attempt to execute one off task " + tag + " multiple " + "times"); return; } else { this.executed = true; this.executionTimes.add(elapsedNowSecs); } } else { logger.log(Log.ERROR, "Attempt to execute task " + tag + " after it was cancelled"); return; } // Handle periodic errors and one-offs differently. // We ignore drift outside this window. This could be a delay due to the JobScheduler/ // AlarmManager, or we just don't care. final int driftAllowed = 10; if (period == 0) { // one-off task if (elapsedNowSecs > windowStopElapsedSecs + driftAllowed || elapsedNowSecs < windowStartElapsedSecs - driftAllowed) { logger.log(Log.ERROR, "Mistimed execution for task " + tag); } else { logger.log(Log.INFO, "Successfully executed one-off task " + tag); } } else { // periodic final int n = executionTimes.size(); // This is the nth execution if (elapsedNowSecs + driftAllowed < (createdAtElapsedSecs) + (n - 1) * this.period) { // Run too early. logger.log(Log.ERROR, "Mistimed execution for task " + tag + ": run too early"); } else if (elapsedNowSecs - driftAllowed > (createdAtElapsedSecs) + n * period) { // Run too late. logger.log(Log.ERROR, "Mistimed execution for task " + tag + ": run too late"); } else { logger.log(Log.INFO, "Successfully executed periodic task " + tag); } } }