protected String doInBackground(String... urls) { String url = urls[0]; String result = ""; HttpResponse response = doResponse(url); if (response == null) { return result; } else { try { result = inputStreamToString(response.getEntity().getContent()); } catch (IllegalStateException e) { Log.e(TAG, e.getLocalizedMessage(), e); } catch (IOException e) { Log.e(TAG, e.getLocalizedMessage(), e); } } return result; }
@Override protected void onResume() { super.onResume(); Toast.makeText(this, "PhotoShareActivity.onResume", Toast.LENGTH_SHORT).show(); AndroidAuthSession session = mApi.getSession(); // The next part must be inserted in the onResume() method of the // activity from which session.startAuthentication() was called, so // that Dropbox authentication completes properly. if (session.authenticationSuccessful()) { try { // Mandatory call to complete the auth session.finishAuthentication(); // Store it locally in our app for later use TokenPair tokens = session.getAccessTokenPair(); storeKeys(tokens.key, tokens.secret); uploadFiles(); setLoggedIn(true); } catch (IllegalStateException e) { showToast("Couldn't authenticate with Dropbox:" + e.getLocalizedMessage()); Log.i(TAG, "Error authenticating", e); } } else { Toast.makeText(this, "PhotoShareActivity.onResume: failed to auth", Toast.LENGTH_LONG).show(); } }
public void receiveTokenAndConnect() { // Dropbox API - recibe el token y se conecta AndroidAuthSession session = mApi.getSession(); if (session.authenticationSuccessful()) { try { // Mandatory call to complete the auth session.finishAuthentication(); // Store it locally in our app for later use TokenPair tokens = session.getAccessTokenPair(); storeKeys(tokens.key, tokens.secret); setLoggedIn(true); // showToast("Logueado bien" + tokens.key + " - " + tokens.secret); } catch (IllegalStateException e) { showToast("Couldn't authenticate with Dropbox:" + e.getLocalizedMessage()); Log.i(DropboxUtil.TAG, "Error authenticating", e); } } }
@Override protected void onResume() { super.onResume(); AndroidAuthSession session = mApi.getSession(); // The next part must be inserted in the onResume() method of the // activity from which session.startAuthentication() was called, so // that Dropbox authentication completes properly. if (session.authenticationSuccessful()) { try { // Mandatory call to complete the auth session.finishAuthentication(); // Store it locally in our app for later use storeAuth(session); setLoggedIn(true); } catch (IllegalStateException e) { showToast("Couldn't authenticate with Dropbox:" + e.getLocalizedMessage()); Log.i(TAG, "Error authenticating", e); } } }
private void checkSyncDropbox() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); // then you use Boolean linked = prefs.getBoolean(SetPreference.SYNC_DROPBOX, false); if (linked) { AndroidAuthSession session = SetPreference.mApi.getSession(); // The next part must be inserted in the onResume() method of the // activity from which session.startAuthentication() was called, so // that Dropbox authentication completes properly. if (session.authenticationSuccessful()) { try { // Mandatory call to complete the auth session.finishAuthentication(); SetPreference.uploadDB(mFileName, EditPage.this); } catch (IllegalStateException e) { showToast("Couldn't authenticate with Dropbox:" + e.getLocalizedMessage()); Log.i(TAG, "Error authenticating", e); } } } }
@Override protected void onResume() { super.onResume(); uiHelper = new UiLifecycleHelper(this, callback); uiHelper.onResume(); try { /* Only activate FaceBook publish install if the user has the FaceBook app installed */ if (com.facebook.Settings.getAttributionId(getContentResolver()) != null) { com.facebook.AppEventsLogger.activateApp(this); } } catch (IllegalStateException e) { Log.d(TAG, "Facebook Setting Exception again!"); } AndroidAuthSession session = mApi.getSession(); // The next part must be inserted in the onResume() method of the // activity from which session.startAuthentication() was called, so // that Dropbox authentication completes properly. if (session.authenticationSuccessful()) { try { // Mandatory call to complete the auth session.finishAuthentication(); // Store it locally in our app for later use TokenPair tokens = session.getAccessTokenPair(); storeKeys(tokens.key, tokens.secret); setLoggedIn(true); } catch (IllegalStateException e) { showToast("Couldn't authenticate with Dropbox:" + e.getLocalizedMessage()); Log.i(TAG, "Error authenticating", e); } } }
/** * Checks whether a world file is associated with the data source. If found, set a proper * envelope. * * @throws IllegalStateException * @throws IOException */ protected void parseWorldFile() { final String worldFilePath = new StringBuffer(this.parentPath) .append(GridCoverageUtilities.SEPARATOR) .append(coverageName) .toString(); File file2Parse = null; boolean worldFileExists = false; // // // // Check for a world file with the format specific extension // // // if (worldFileExt != null && worldFileExt.length() > 0) { file2Parse = new File(worldFilePath + worldFileExt); worldFileExists = file2Parse.exists(); } // // // // Check for a world file with the default extension // // // if (!worldFileExists) { file2Parse = new File(worldFilePath + GridCoverageUtilities.DEFAULT_WORLDFILE_EXT); worldFileExists = file2Parse.exists(); } if (worldFileExists) { try { final WorldFileReader reader = new WorldFileReader(file2Parse); raster2Model = reader.getTransform(); // // // // In case we read from a real world file we have together the // envelope. World file transformation assumes to work in the // CELL_CENTER condition // // // MathTransform tempTransform = PixelTranslation.translate( raster2Model, PixelInCell.CELL_CENTER, PixelInCell.CELL_CORNER); final Envelope gridRange = new GeneralEnvelope((GridEnvelope2D) originalGridRange); final GeneralEnvelope coverageEnvelope = CRS.transform(tempTransform, gridRange); originalEnvelope = coverageEnvelope; return; } catch (TransformException e) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e); } } catch (IllegalStateException e) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e); } } catch (IOException e) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e); } } } // if we got here we did not find a suitable transform raster2Model = null; }