0
Intentservice의 onHandleIntent() 메소드에서 간단한 fql 쿼리를 실행하고 있습니다. 문제는 무엇인지 알지 못하지만 쿼리 부분은 실행되지 않습니다. 여기에 내 onHandleIntent() 메서드가 있습니다.Android IntentService 관련 문제
protected void onHandleIntent(Intent intent)
{
System.out.println("inside service method now");
String fqlQuery = "SELECT uid, username, online_presence, status FROM user WHERE uid = 100001024732884";
Bundle params = new Bundle();
params.putString("q", fqlQuery);
Session session = Session.getActiveSession();
Request request = new Request(session,
"/fql",
params,
HttpMethod.GET,
new Request.Callback(){
public void onCompleted(Response response) {
System.out.println("inside the service now 4444");
Log.i(TAG, "Result: " + response.toString());
}
});
Request.executeBatchAsync(request);
}
첫 번째 문만 인쇄됩니다.
내 MainActivity에 동일한 코드를 삽입하면 작동하지만 IntentService에서는 작동하지 않습니다. 나는 buttonclick에 서비스를 시작하고있다.
오류를 먼저 catch해야합니다. 이 메서드는 약간의 오류를 던져야합니다. 메서드에서 try catch를 사용하고 오류를 catch하십시오. 그런 다음 문제를 해결할 수 있습니다. –
'지금 서비스 내부에서 4444'만 인쇄되는 것을 의미합니까? – gunar
아니요, 첫 번째 인쇄 명령문 만 실행됩니다. – user1872750