안녕하세요. 끔찍한 상황이 있습니다. 세션 내 위치 공유 로직을 만들고 있습니다. mysql 서버에서 세션을 유지하고 있습니다. 해당 활동에 안드로이드가 안타를 치면 그에 따라 사용자 정보가 삽입됩니다. 안드로이드가 그 활동을 떠날 때 세션이 반대편으로 버려지도록 그 칼럼을 삭제합니다. 하나의 이슈가 될 때까지는 모든 것이 좋습니다 .Android는 앱에서 콜백을 제공하지 않고, 앱을 끌고 간다는 앱이 완전하게 죽었습니다. 나는 원하는 활동에 도달하자마자 서비스와 시작 서비스를 사용하고 있습니다. 서비스에서 나는 앱이 recents에서 그것을 스 와이프하여 죽은 즉시 알려주는 onTaskRemoved()라는 간단한 것을 가지고 있습니다. 내가 원하는 열을 제거하기 위해 내 서버에 전화를 걸고 싶습니다. 전화가 연결되지 않고 응답을받지 못합니다. 그러나 onDe에서는 STROY()와 같은 expected.Actually 여기서 일하는 모든 코드Android onTaskRemoved() 웹 서비스 호출
@Override
public void onTaskRemoved(Intent rootIntent) {
destroySession();
super.onTaskRemoved(rootIntent);
}
private void destroySession() {
Log.d("Fsafasfsafasfas", "destroySession: " + opponentId + " my user id" + sharedHelper.getUserId());
Call<ResponseBody> locationCall = Retrofit.getInstance().getInkService().requestFriendLocation(sharedHelper.getUserId(), opponentId, "", "", Constants.LOCATION_REQUEST_TYPE_DELETE);
locationCall.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
if (response == null) {
destroySession();
return;
}
if (response.body() == null) {
destroySession();
return;
}
try {
String responseBody = response.body().string();
Log.d("Fsafasfsafasfas", "onResponse: " + responseBody);
JSONObject jsonObject = new JSONObject(responseBody);
boolean success = jsonObject.optBoolean("success");
if (success) {
stopSelf();
} else {
destroySession();
}
} catch (IOException e) {
stopSelf();
e.printStackTrace();
} catch (JSONException e) {
stopSelf();
e.printStackTrace();
}
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
destroySession();
}
});
}
i가 인쇄되는 경우에만 로그 추측을 통해 통화가 얻을 수 없을 것입니다 단서 무슨 일이 more..Anyone 아이디의 로그 및 아무것도입니다 어떻게 된거 야?
안녕하세요.이 문제에 대한 해결책을 얻었습니까? 고맙습니다. – user1510006
아직 :(coudl을 통해 얻지 못했습니다 –
OK, 감사합니다 :) – user1510006