销毁活动时取消了注销管理推送的HTTP请求

时间:2019-04-27 08:23:43

标签: android sinch

我想在注销用户时取消注册管理器。但是当我“清除”所有活动时,取消对不安全令牌的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();
        }

0 个答案:

没有答案