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.radicaldynamic.groupinform.activities.AccountDeviceList.java
public static ArrayList<AccountDevice> loadDeviceList() { if (Collect.Log.DEBUG) Log.d(Collect.LOGTAG, t + "loading device cache"); ArrayList<AccountDevice> devices = new ArrayList<AccountDevice>(); if (!new File(Collect.getInstance().getCacheDir(), FileUtilsExtended.DEVICE_CACHE_FILE).exists()) { if (Collect.Log.WARN) Log.w(Collect.LOGTAG, t + "device cache file cannot be read: aborting loadDeviceList()"); return devices; }/*ww w . j a v a 2 s .c om*/ try { FileInputStream fis = new FileInputStream( new File(Collect.getInstance().getCacheDir(), FileUtilsExtended.DEVICE_CACHE_FILE)); InputStreamReader reader = new InputStreamReader(fis); BufferedReader buffer = new BufferedReader(reader, 8192); StringBuilder sb = new StringBuilder(); String cur; while ((cur = buffer.readLine()) != null) { sb.append(cur + "\n"); } buffer.close(); reader.close(); fis.close(); try { // int assignedSeats = 0; JSONArray jsonDevices = (JSONArray) new JSONTokener(sb.toString()).nextValue(); for (int i = 0; i < jsonDevices.length(); i++) { JSONObject jsonDevice = jsonDevices.getJSONObject(i); AccountDevice device = new AccountDevice(jsonDevice.getString("id"), jsonDevice.getString("rev"), jsonDevice.getString("alias"), jsonDevice.getString("email"), jsonDevice.getString("status")); // Optional information that will only be present if the user is also an account owner device.setLastCheckin(jsonDevice.optString("lastCheckin")); device.setPin(jsonDevice.optString("pin")); device.setRole(jsonDevice.optString("role")); // Update the lookup hash Collect.getInstance().getInformOnlineState().getAccountDevices().put(device.getId(), device); // Show a device so long as it hasn't been marked as removed if (!device.getStatus().equals("removed")) { devices.add(device); // assignedSeats++; } } // // Record the number of seats in this account that are assigned & allocated (not necessarily "active") // Collect.getInstance().getInformOnlineState().setAccountAssignedSeats(assignedSeats); } catch (JSONException e) { // Parse error (malformed result) if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, t + "failed to parse JSON " + sb.toString()); e.printStackTrace(); } } catch (Exception e) { if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, t + "unable to read device cache: " + e.toString()); e.printStackTrace(); } return devices; }
From source file:com.pr.carjoin.chat.ChatMainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.invite_menu: sendInvitation();/* ww w .j a va 2 s.c o m*/ return true; case R.id.crash_menu: FirebaseCrash.logcat(Log.ERROR, TAG, "crash caused"); causeCrash(); return true; case R.id.sign_out_menu: mFirebaseAuth.signOut(); Auth.GoogleSignInApi.signOut(mGoogleApiClient); mFirebaseUser = null; mUsername = ANONYMOUS; mPhotoUrl = null; startActivity(new Intent(this, LoginActivity.class)); return true; case R.id.fresh_config_menu: fetchConfig(); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.googlecode.eyesfree.brailleback.BrailleBackService.java
private void initializeLabelManager() { if (Build.VERSION.SDK_INT >= CustomLabelManager.MIN_API_LEVEL) { try {// ww w.j a v a 2s . c o m mLabelManager = new CustomLabelManager(this); } catch (SecurityException e) { // Don't use labeling features if there's a permission denial // due to a key mismatch LogUtils.log(this, Log.ERROR, "Not using labeling due to permission denial."); } if (mLabelManager != null) { mPackageReceiver = new PackageRemovalReceiver(); registerReceiver(mPackageReceiver, mPackageReceiver.getFilter()); mLabelManager.ensureDataConsistency(); } } }
From source file:eu.liveandgov.ar.core.ARViewFragment.java
/** Start renderer if not already done */ @Override/* w w w. j a va 2 s. c o m*/ public void onDrawFrame() { try { if (mRendererInitialized) metaioSDK.render(); } catch (Exception e) { MetaioDebug.log(Log.ERROR, "ARViewActivity.onDrawFrame: Rendering failed with error " + e.getMessage()); } }
From source file:com.googlecode.eyesfree.brailleback.BrailleIME.java
public boolean route(int position, DisplayManager.Content content) { InputConnection ic = getCurrentInputConnection(); Spanned text = content.getSpanned(); if (ic != null && text != null) { MarkingSpan[] spans = text.getSpans(position, position, MarkingSpan.class); if (spans.length == 1) { if (spans[0] == ACTION_LABEL_SPAN) { return emitFeedbackOnFailure(sendDefaultAction(), FeedbackManager.TYPE_COMMAND_FAILED); } else if (spans[0] == EDIT_TEXT_SPAN) { return emitFeedbackOnFailure(setCursor(ic, position - text.getSpanStart(EDIT_TEXT_SPAN)), FeedbackManager.TYPE_COMMAND_FAILED); }/*from www . jav a2 s . c om*/ } else if (spans.length == 0) { // Most likely, the user clicked on the label/hint part of the // content. emitFeedback(FeedbackManager.TYPE_NAVIGATE_OUT_OF_BOUNDS); return true; } else if (spans.length > 1) { LogUtils.log(this, Log.ERROR, "Conflicting spans in Braille IME"); } } emitFeedback(FeedbackManager.TYPE_COMMAND_FAILED); return true; }
From source file:net.vleu.par.android.rpc.Transceiver.java
/** * Performs authentication if necessary, then exchange the data with the * server and returns the response//from w w w. j a va 2 s . com * * @param request * @return The response to the request, null if none * @throws IOException * @throws OperationCanceledException * @throws AuthenticatorException */ public GatewayResponseData exchangeWithServer(final GatewayRequestData request) throws IOException, OperationCanceledException, AuthenticatorException { final int maxRetries = 10; for (int retry = 0; retry < maxRetries; retry++) { if (!hasSacsidToken()) { /* Gets a Google Auth Token and promotes it to a SACSID Token */ final GoogleAuthToken googleAuthToken = blockingGetNewAuthToken(); try { promoteToken(googleAuthToken); } catch (final InvalidGoogleAuthTokenException e) { if (Log.isLoggable(TAG, Log.WARN)) Log.w(TAG, "The google auth token is invalid. Refreshing all cookies. ", e); invalidatesGoogleAuthToken(googleAuthToken); clearSacsidToken(); continue; } } /* Executes the query */ try { return postData(request); } catch (final AuthenticationTokenExpired e) { clearSacsidToken(); if (Log.isLoggable(TAG, Log.WARN)) Log.w(TAG, "Google and/or SACSID tokens expired. Retried " + retry + " times.", e); continue; } } final String failureMessage = "Failed to get valid Google and SACSID tokens !"; if (Log.isLoggable(TAG, Log.ERROR)) Log.e(TAG, failureMessage); throw new AuthenticatorException(failureMessage); }
From source file:com.daul.chat.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.sign_out_menu: mFirebaseAuth.signOut();//w w w . j a va 2 s . c om Auth.GoogleSignInApi.signOut(mGoogleApiClient); mUsername = ANONYMOUS; startActivity(new Intent(this, SignInActivity.class)); return true; case R.id.fresh_config_menu: fetchConfig(); return true; case R.id.invite_menu: sendInvitation(); return true; case R.id.crash_menu: FirebaseCrash.logcat(Log.ERROR, TAG, "crash caused"); causeCrash(); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.radicaldynamic.groupinform.services.InformOnlineService.java
private boolean checkout() { boolean saidGoodbye = false; String checkoutUrl = Collect.getInstance().getInformOnlineState().getServerUrl() + "/checkout"; String getResult = HttpUtils.getUrlData(checkoutUrl); JSONObject checkout;/*from w w w . java 2s . c om*/ try { checkout = (JSONObject) new JSONTokener(getResult).nextValue(); String result = checkout.optString(InformOnlineState.RESULT, InformOnlineState.ERROR); if (result.equals(InformOnlineState.OK)) { if (Collect.Log.INFO) Log.i(Collect.LOGTAG, t + "said goodbye to Group Complete"); } else { if (Collect.Log.DEBUG) Log.d(Collect.LOGTAG, t + "device checkout unnecessary"); } saidGoodbye = true; } catch (NullPointerException e) { // Communication error if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, t + "no getResult to parse. Communication error with node.js server?"); e.printStackTrace(); } catch (JSONException e) { // Parse error (malformed result) if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, t + "failed to parse getResult " + getResult); e.printStackTrace(); } finally { // Running a checkout ALWAYS "signs us out" mSignedIn = false; } Collect.getInstance().getInformOnlineState().setSession(null); return saidGoodbye; }
From source file:eu.liveandgov.ar.core.ARViewFragment.java
/** On OpenGL surface created : Initialize renderer */ @Override//from w ww. jav a 2 s .c om public void onSurfaceCreated() { deb("ARViewFragment", "onSurfaceCreated"); MetaioDebug.log("ARViewActivity.onSurfaceCreated: GL thread: " + Thread.currentThread().getId()); try { // initialized the renderer if (!mRendererInitialized) { metaioSDK.initializeRenderer(mGLSurfaceView.getWidth(), mGLSurfaceView.getHeight(), Screen.getRotation(getActivity()), ERENDER_SYSTEM.ERENDER_SYSTEM_OPENGL_ES_2_0); mRendererInitialized = true; } else { MetaioDebug.log("ARViewActivity.onSurfaceCreated: Reloading textures..."); metaioSDK.reloadOpenGLResources(); } // connect the audio callbacks //MetaioDebug.log("ARViewActivity.onSurfaceCreated: Registering audio renderer..."); //metaioSDK.registerAudioCallback( mGLSurfaceView.getAudioRenderer() ); MetaioDebug.log("ARViewActivity.onSurfaceCreated"); } catch (Exception e) { MetaioDebug.log(Log.ERROR, "ARViewActivity.onSurfaceCreated: " + e.getMessage()); } }
From source file:com.radicaldynamic.groupinform.services.DatabaseService.java
synchronized public ReplicationStatus replicate(String db, int mode) { final String tt = t + "replicate(): "; if (Collect.Log.DEBUG) Log.d(Collect.LOGTAG, tt + "about to replicate " + db); // Will not replicate unless signed in if (!Collect.getInstance().getIoService().isSignedIn()) { if (Collect.Log.DEBUG) Log.d(Collect.LOGTAG, tt + "aborting replication: not signed in"); return null; }//from w ww. j a va2 s .c o m if (Collect.getInstance().getInformOnlineState().isOfflineModeEnabled()) { if (Collect.Log.DEBUG) Log.d(Collect.LOGTAG, tt + "aborting replication: offline mode is enabled"); return null; } /* * Lookup master cluster by IP. Do this instead of relying on Erlang's internal resolver * (and thus Google's public DNS). Our builds of Erlang for Android do not yet use * Android's native DNS resolver. */ String masterClusterIP = null; try { InetAddress[] clusterInetAddresses = InetAddress .getAllByName(getString(R.string.tf_default_ionline_server)); masterClusterIP = clusterInetAddresses[new Random().nextInt(clusterInetAddresses.length)] .getHostAddress(); } catch (UnknownHostException e) { if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, tt + "unable to lookup master cluster IP addresses: " + e.toString()); e.printStackTrace(); } // Create local instance of database boolean dbCreated = false; // User may not have connected to local database yet - start up the connection for them try { if (mLocalDbInstance == null) { connectToLocalServer(); } } catch (DbUnavailableException e) { if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, tt + "cannot connect to local database server"); e.printStackTrace(); } if (mLocalDbInstance.getAllDatabases().indexOf("db_" + db) == -1) { switch (mode) { case REPLICATE_PULL: if (Collect.Log.INFO) Log.i(Collect.LOGTAG, tt + "creating local database " + db); mLocalDbInstance.createDatabase("db_" + db); dbCreated = true; break; case REPLICATE_PUSH: // If the database does not exist client side then there is no point in continuing if (Collect.Log.WARN) Log.w(Collect.LOGTAG, tt + "cannot find local database " + db + " to push"); return null; } } // Configure replication direction String source = null; String target = null; String deviceId = Collect.getInstance().getInformOnlineState().getDeviceId(); String deviceKey = Collect.getInstance().getInformOnlineState().getDeviceKey(); String localServer = "http://" + mLocalHost + ":" + mLocalPort + "/db_" + db; String remoteServer = "http://" + deviceId + ":" + deviceKey + "@" + masterClusterIP + ":5984/db_" + db; // Should we use encrypted transfers? SharedPreferences settings = PreferenceManager .getDefaultSharedPreferences(Collect.getInstance().getBaseContext()); if (settings.getBoolean(PreferencesActivity.KEY_ENCRYPT_SYNCHRONIZATION, true)) { remoteServer = "https://" + deviceId + ":" + deviceKey + "@" + masterClusterIP + ":6984/db_" + db; } switch (mode) { case REPLICATE_PUSH: source = localServer; target = remoteServer; break; case REPLICATE_PULL: source = remoteServer; target = localServer; break; } ReplicationCommand cmd = new ReplicationCommand.Builder().source(source).target(target).build(); ReplicationStatus status = null; try { status = mLocalDbInstance.replicate(cmd); } catch (Exception e) { // Remove a recently created DB if the replication failed if (dbCreated) { if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, t + "replication exception: " + e.toString()); e.printStackTrace(); mLocalDbInstance.deleteDatabase("db_" + db); } } return status; }