0
트위터 피드의 간단한 구문 분석을하려고합니다. 사용자의 json 피드를 트위터에서 요청하고이를 개체로 파싱하기 만하면됩니다.Android에서 Twitter 피드 가져 오기 - 기기에서 요금 한도를 초과 했습니까?
이 문제는 에뮬레이터에서 완벽하게 작동하지만 실제 장치에 배포 할 때 403 속도 제한을 초과하는 것으로 보이는 400 가지 나쁜 요청 응답을 얻지 만 이것이 가장 먼저 전송 된 요청이므로 어떻게 속도 한도를 초과합니까? 나는이 장치에서 작동하도록하려면 어떻게해야 뭔가가
암 : 여기
public ArrayList<Tweet> getTweets() {
ArrayList<Tweet> tweets =
new ArrayList<Tweet>();
HttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet(twitterUrl);
ResponseHandler<String> responseHandler =
new BasicResponseHandler();
String responseBody = null;
try {
responseBody = client.execute(get, responseHandler);
} catch(Exception ex) {
ex.printStackTrace();
timeOut = true;
}
JSONObject jsonObject = null;
JSONArray arr = null;
try {
arr = new JSONArray(responseBody);
} catch (JSONException e1) {
e1.printStackTrace();
timeOut = true;
}
for (int i = 0; i < arr.length(); i++) {
try {
jsonObject = arr.getJSONObject(i);
} catch (JSONException e1) {
e1.printStackTrace();
timeOut = false;
}
Tweet tweet = null;
try {
tweet = new Tweet(
jsonObject.getJSONObject("user").getString("name"),
jsonObject.getString("text"),
jsonObject.getJSONObject("user").getString("profile_image_url"),
twitterHumanFriendlyDate(jsonObject.getString("created_at"))
);
} catch (JSONException e) {
e.printStackTrace();
timeOut = true;
}
tweets.add(tweet);
}
return tweets;
}
구문 분석하는 피드의 예입니다? 나는 Titter 등으로 등록하지 않았다. Google Maps 키와 비슷한 Twiiter 키를 얻어야 만 하는가?
EDIT : 실제로 Wi-Fi를 통해 작동하지만 모바일 데이터 연결에서는 작동하지 않습니다. 모바일 연결의 속도 제한을 막을 수 있습니까?