How to get Context in Android MVVM ViewModel

You can use an Application context which is provided by the AndroidViewModel, you should extend AndroidViewModel which is simply a ViewModel that includes an Application reference.

Leave a Comment