abort connection in Android SDK
  • Hi Karim,

    I have a case where the user sign out from the app and I need to cancel all the Asynctasks that are running in the background, including the android client calls, GetUser..
    My question is in http we have httpPost.abort();

    but in apstrata android sdk how can I abort a connection.

    Thank you
  • Hi Nour,

    You cannot abort an HTTP request using the Apstrata SDK. 

    Also note as a reminder, that an Apstrata connection does not translate to a permanent link between the client and the back-end. It is merely a means to wrap users credentials and to provide signing facility. Therefore, the only thing you need to do is to get rid of the connection instance.

  • hi again,

    What I need is to the abort the client request 

    Client client = new Client(
    response = client.callAPIFile("GetFile", parameters, AuthMode.SIMPLE, getActivity().getApplicationCo..)

    I gave http.abort() as an example , but I dont want to use Android SDK to abort http connection , I want to know how we stop or abort a client call (let's say callAPIFile in androidSDK), how to cancel a request in androidSDK ..like Client.cancel() or anything  that stops androidSDK calls 
  • Hi Nour,

    I got your need from the first time ;) 

    Unfortunately, as I mentioned, you cannot currently abort a request using our SDK. 

    This is however a feature that we might need to implement and we are looking into it right now. In the meantime, feel free to modify the SDK to suit your needs.

  • OK Thank you, if you implemented this in your Android SDK please let us know.

  • Hi Nour,

    There is an immediate and simple workaround if you are interested:

    The Apstrata SDK Client class exposes the public "callAPIStream()" method that accepts an HttpClient instance as a parameter. You can create such an instance and pass it to the method when downloading a file from Apstrata.

    Whenever you need to abort the request, just invoke: httpClient.getConnectionManager().shutdown()

    That should do the trick


Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!