title: How to get live data from WorkManager in Android
body: <p><br></p>
  
  <p>I am trying to make API call from <code>doWork()</code> method of <strong>WorkManager</strong>. I receive <code>MutableLiveData</code> with list from response. How to set this complex object as output from WorkManager.<br>
  Please find below implementation for the same :</p>
  
  <pre><code>class FetchWorkManager(context: Context, params: WorkerParameters): Worker(context,params) {
  var postInfoLiveData: LiveData&lt;List&lt;PostInfo&gt;&gt; = MutableLiveData()
  
  @SuppressLint("RestrictedApi")
  override fun doWork(): Result {
      fetchInfoFromRepository()
      //setting output data
      val data = Data.Builder()
          .putAll(postInfoLiveData)
          //.put("liveData",postInfoLiveData)
          .build()
      return Result.success(data)
  }
  
  
  fun fetchInfoFromRepository(){
      val retrofitRepository = RetrofitRepository()
      postInfoLiveData = retrofitRepository.fetchPostInfoList()
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p><br>
  Can anyone help me in resolving this issue.</p>