title: Accessing BroadCastReceiver in Viewmodel
body: <p>I am struggling in choosing the right way to pass data from broadcastReceiver to ViewModel and from there I pass data to my Repository and update LiveData. I use FCM push notifications and have local broadCastReceiver which uses ActivityLifecycle. </p>
  
  <p>I found that it is bad practice to access ViewModel from BroadcastReceiver, but not sure why? </p>
  
  <p>If I manage lifecycle of broadcastReceiver it should not cause any problems... <strong>So what is the best way to pass received data from FCM to my Repository's MediatorLiveData?</strong> I use MediatorLiveData, because I add different LiveData sources(API request and FCM). </p>
  
  <p>Would be grateful for advice and correct way of implementing broadCastReceiver.</p>
  
  <p>I have thought about accessing Repository from BroadCastReceiver, like this:</p>
  
  <pre><code>RepositoryMain.getSingletonInstance().setResponse(state);
  </code></pre>