Android Open Source - photo-paper User Info Intent Service

From Project

Back to project page photo-paper.


The source code is released under:

MIT License

If you think the Android project photo-paper listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*  ww w.j av  a2s. c  om*/
import android.content.Intent;

import com.fivehundredpx.api.PxApi;
import com.lukekorth.android_500px.BuildConfig;
import com.lukekorth.android_500px.WallpaperApplication;
import com.lukekorth.android_500px.models.User;
import com.lukekorth.android_500px.models.UserUpdatedEvent;

import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.LoggerFactory;

public class UserInfoIntentService extends IntentService {

    public UserInfoIntentService() {

    protected void onHandleIntent(Intent intent) {
        PxApi pxApi = new PxApi(User.getLoggedInUserAccessToken(), BuildConfig.CONSUMER_KEY,
        try {
            JSONObject jsonUser = pxApi.get("/users").getJSONObject("user");

            User user = User.getUser();
   = jsonUser.getInt("id");
            user.userName = jsonUser.getString("username");
            user.firstName = jsonUser.getString("firstname");
            user.lastName = jsonUser.getString("lastname");
   = jsonUser.getString("userpic_url");

            WallpaperApplication.getBus().post(new UserUpdatedEvent(user));
        } catch (JSONException e) {

Java Source Code List