HTTP-запрос на отмену регистрации управления push был отменен при уничтожении активности - PullRequest
0 голосов
/ 27 апреля 2019

Я хочу отменить регистрацию при выходе из системы моего пользователя.но когда я «очистил» все действия, http-запрос к незарегистрированному токену был отменен.это исключение.

2019-04-27 15:12:59.945 14608-14608/com.example.tranquoctrungcntt.uchat D/Start sinch www: onCreate
2019-04-27 15:12:59.956 14608-14608/com.example.tranquoctrungcntt.uchat D/ReLinkerLibraryLoader: Beginning load of sinch-android-rtc...
2019-04-27 15:12:59.960 14608-14608/com.example.tranquoctrungcntt.uchat D/ReLinkerLibraryLoader: sinch-android-rtc (3.13.0) was loaded normally!
2019-04-27 15:13:00.889 14608-14608/com.example.tranquoctrungcntt.uchat D/Start sinch www: SINCH START
2019-04-27 15:14:28.270 14608-14672/com.example.tranquoctrungcntt.uchat D/DefaultHttpService: Http request to https://clientapi.sinch.com/V1/PushProfile
2019-04-27 15:14:28.275 14608-14672/com.example.tranquoctrungcntt.uchat D/HttpClient: Scheduling request: {id='e5d02372-e446-402c-8709-72993cf46f22', url='https://clientapi.sinch.com/V1/PushProfile', method='DELETE', headers={Accept=text/json, Content-Type=application/json; charset=utf-8}}
2019-04-27 15:14:28.277 14608-14608/com.example.tranquoctrungcntt.uchat D/Start sinch www: SINCH STOP
2019-04-27 15:14:28.319 14608-14608/com.example.tranquoctrungcntt.uchat D/HttpClient: Adding request entry e5d02372-e446-402c-8709-72993cf46f22|1 to queue ({id='1', request={id='e5d02372-e446-402c-8709-72993cf46f22', url='https://clientapi.sinch.com/V1/PushProfile', method='DELETE', headers={Accept=text/json, Content-Type=application/json; charset=utf-8}}, priority=1})
2019-04-27 15:14:28.489 14608-14608/com.example.tranquoctrungcntt.uchat E/DefaultHttpService: Error while executing http request: 
    java.util.concurrent.CancellationException: Cancelled before starting background execution
        at com.sinch.httpclient.AsyncTaskRequest.start_main(Unknown Source:12)
        at com.sinch.httpclient.AsyncTaskRequest.access$000(Unknown Source:0)
        at com.sinch.httpclient.AsyncTaskRequest$1.run(Unknown Source:2)
        at android.os.Handler.handleCallback(Handler.java:891)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:207)
        at android.app.ActivityThread.main(ActivityThread.java:7539)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)

и это мой код "выхода из системы":

  if (mSinchServiceInterface!=null && isConnectedToSinchService)
                        mSinchServiceInterface.stopClient();

  Intent it=new Intent(mContext,Login.class);
it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TASK);
((Activity)mContext).overridePendingTransition(R.anim.slideup_in,R.anim.slidedown_out);
 mContext.startActivity(it);
 ((Activity) mContext).finish();
if (FirebaseAuth.getInstance().getCurrentUser()!=null) FirebaseAuth.getInstance().signOut();

это метод stopClient:

if (isStarted()) {
            mSinchClient.unregisterManagedPush();
            mSinchClient.terminateGracefully();
        }
...