Java Code Examples for com.googlecode.flickrjandroid.oauth.OAuth#getToken()
The following examples show how to use
com.googlecode.flickrjandroid.oauth.OAuth#getToken() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AddCommentTask.java From glimmr with Apache License 2.0 | 6 votes |
@Override protected String doInBackground(OAuth... params) { OAuth oauth = params[0]; if (oauth != null) { OAuthToken token = oauth.getToken(); try { Flickr f = FlickrHelper.getInstance().getFlickrAuthed( token.getOauthToken(), token.getOauthTokenSecret()); return f.getCommentsInterface().addComment(mPhoto.getId(), mCommentText); } catch (Exception e) { e.printStackTrace(); mException = e; } } else { Log.e(TAG, "AddCommentTask requires authentication"); } return null; }
Example 2
Source File: LoadContactsPhotosTask.java From glimmr with Apache License 2.0 | 6 votes |
@Override protected List<Photo> doInBackground(OAuth... params) { OAuth oauth = params[0]; if (oauth != null) { OAuthToken token = oauth.getToken(); Flickr f = FlickrHelper.getInstance().getFlickrAuthed( token.getOauthToken(), token.getOauthTokenSecret()); try { return f.getPhotosInterface().getContactsPhotos( Constants.FETCH_PER_PAGE, Constants.EXTRAS, false, false, false, mPage, Constants.FETCH_PER_PAGE); } catch (Exception e) { e.printStackTrace(); mException = e; } } else { Log.e(TAG, "LoadContactsPhotosTask requires authentication"); } return null; }
Example 3
Source File: LoadGroupsTask.java From glimmr with Apache License 2.0 | 6 votes |
@Override protected Collection<Group> doInBackground(OAuth... params) { OAuth oauth = params[0]; if (oauth != null) { OAuthToken token = oauth.getToken(); Flickr f = FlickrHelper.getInstance().getFlickrAuthed( token.getOauthToken(), token.getOauthTokenSecret()); try { return f.getPoolsInterface().getGroups(); } catch (Exception e) { e.printStackTrace(); mException = e; } } else { Log.e(TAG, "LoadGroupsTask requires authentication"); } return null; }
Example 4
Source File: SetFavoriteTask.java From glimmr with Apache License 2.0 | 6 votes |
@Override protected Exception doInBackground(OAuth... params) { OAuth oauth = params[0]; if (oauth != null) { OAuthToken token = oauth.getToken(); Flickr f = FlickrHelper.getInstance().getFlickrAuthed( token.getOauthToken(), token.getOauthTokenSecret()); try { if (mPhoto.isFavorite()) { f.getFavoritesInterface().remove(mPhoto.getId()); } else { f.getFavoritesInterface().add(mPhoto.getId()); } } catch (Exception e) { e.printStackTrace(); return e; } } else { Log.e(TAG, "SetFavoriteTask requires authentication"); } return null; }
Example 5
Source File: LoadFlickrActivityTask.java From glimmr with Apache License 2.0 | 6 votes |
@Override protected List<Item> doInBackground(OAuth... params) { OAuth oauth = params[0]; if (oauth != null) { OAuthToken token = oauth.getToken(); try { Flickr f = FlickrHelper.getInstance().getFlickrAuthed( token.getOauthToken(), token.getOauthTokenSecret()); String timeFrame = "100d"; int page = 1; return f.getActivityInterface().userPhotos( Constants.FETCH_PER_PAGE, page, timeFrame); } catch (Exception e) { e.printStackTrace(); mException = e; } } else { Log.e(TAG, "LoadFlickrActivityTask requires authentication"); } return null; }
Example 6
Source File: LoginFragment.java From glimmr with Apache License 2.0 | 5 votes |
private void persistAccessToken(OAuth oauth) { SharedPreferences sp = mActivity.getSharedPreferences( Constants.PREFS_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); OAuthToken token = oauth.getToken(); User user = oauth.getUser(); editor.putString(Constants.KEY_OAUTH_TOKEN, token.getOauthToken()); editor.putString(Constants.KEY_TOKEN_SECRET, token .getOauthTokenSecret()); editor.putString(Constants.KEY_ACCOUNT_USER_NAME, user.getUsername()); editor.putString(Constants.KEY_ACCOUNT_USER_ID, user.getId()); editor.commit(); }