1. Are you ready for the Galaxy S20? Here is everything we know so far!

how to make a Service and AsyncTask comunication

Discussion in 'Android Development' started by tsue, Jul 12, 2017.

  1. tsue

    tsue Lurker
    Thread Starter

    hello, i have this issue:
    I have a main activity that is binded to the service,
    Also that main activity can call a class(AsyncTask) that is a client to connect to a server and waits for data

    i tried to make the bind from class(AsyncTask) client to the service,
    but i dont know if thats not possible
    or do i have to return data to main activity so main activity can send it to the service?

    i can do this in the main class

    Intent intent = new Intent(getApplication(), ChatHeadService.class);
    startService(intent);
    bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE);

    but how can i implement it in the class(AsyncTask) client?
     


    #1 tsue, Jul 12, 2017
    Last edited: Jul 12, 2017
    sweetndreemy73 likes this.

    1. Download the Forums for Android™ app!


      Download

       
Loading...

Share This Page

Loading...