Q: How to use ViewModel in Android with LiveData from repository (DB/network)? I have Fragment/Activity that needs to display some data. 
The data are coming from web API (or can come from DB).
I have Repository class that exposes this data as LiveData making request to web API or DB. 
Now, I need to implement ViewModel with LiveData and consider how I should do this correctly. I have try to resemble this example: 
https://github.com/googlesamples/android-architecture-components/blob/master/GithubBrowserSample/app/src/main/java/com/android/example/github/ui/repo/RepoViewModel.kt
But this example is very specific. As I understand it I have: 


*

*repoId -> which I need to set from VIEW using setId() at the start
of Activity/Fragment 

*then I can refresh data in view model's LiveData using retry() which only resets repoId with the same value 


*repo, contributions - real observable LiveData are making request by repository to Web API each time repoId is set using
Transofrmations.switchMap()



So: In Activity I need to: 


*

*viewModel.repo.observe(), viewModel.contributions.observe() 

*viewModel.setId() - to get initial data loading 

*viewModel.retry() - each time I want to refresh data in VIEW 
Now in my Activity I need to display First Name/Last Name in Navigation Drawer. 
1. I need to load this data on Activity create 
2. I need to refresh this data each time Drawer is opened or maybe on Activity Restart (from background) 
3. I have UserProfileRepository.getUserProfile() -> returning LiveData 
Here is my problem! this request to web api doesn't need any ID as it just takes user profile based on current authentication token in header (this is passed to HTTP request headers using interceptor) 
So I don't have any repoId or userId (in my case) to make it MutableLiveData and then make other properties on view model using Transformations.switchMap. 
I have tried to directly return LiveData with: 
fun getUserProfile() : LiveData<UserProfile> { 
   return repository.getUserProfile()
}

But here was problem with refreshing View as future calls to getUserProfile() just returns new Observable LiveData, instead notifying previous LiveData observer. 
I think I could use some MediatorLiveData and local LiveData property in ViewModel but this seems a little overcomplicated. 
So I conceived such approach (using fake refresher private property of type LiveData<Int>). It function as a trigger for Transformations.switchMap() blocks to execute each time I want to refresh userProfile (or enforce repository to make web api request, return new LiveData<T> and as I understand place this new data in ViewModel property userProfile live data. This way my Activity's Observer will be notified with actual web api data each time I call refresh() method. 
class UserProfileViewModel
@Inject constructor(private val userProfileRepo: UserProfileRepository) : ViewModel()  {

    private val refresher : MutableLiveData<Int> = MutableLiveData()

    val userProfile : LiveData<Resource<UserProfile>> = Transformations.switchMap(refresher) { refreshCount ->
        userProfileRepo.getUserProfile()
    }

    fun refresh() {
        refresher.value = (refresher.value ?: 0) +  1
    }
}

Is this approach correct way to solve this problem? Or should I implement it in other way.
