-
-
Save skiph/0fa5a075603bb5112958afaf6e14a91c to your computer and use it in GitHub Desktop.
API Key Proxy - modified photo requester
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PhotoRequester { | |
// ... | |
public void getPhoto() throws IOException { | |
// grab the current calendar date and back up one day for next request | |
final String date = mDateFormat.format(mCalendar.getTime()); | |
mCalendar.add(Calendar.DAY_OF_YEAR, -1); | |
// build and call the request | |
String urlRequest = mContext.getString(R.string.api_url) + | |
BASE_PATH + DATE_PARAMETER + date; | |
/* ************ REMOVE API_KEY FROM urlRequest ************* | |
urlRequest += API_KEY_PARAMETER + mContext.getString(R.string.api_key); | |
*/ | |
final Request request = new Request.Builder().url(urlRequest).build(); | |
mLoadingData = true; | |
mClient.newCall(request).enqueue(new Callback() { | |
@Override | |
public void onFailure(Call call, IOException e) { | |
// ... | |
} | |
@Override | |
public void onResponse(Call call, Response response) throws IOException { | |
// ... | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment