79120773

Date: 2024-10-24 07:24:52
Score: 1.5
Natty:
Report link

The problem was actually that the LocationRepository instances in the LocationService and in the LocationViewModel were different (checked this using Log.d(className, "Hash code : $locationRepository.hashCode()) and therefore the LocationViewModel was not subscribing to the right repository.

To solve the issue I added @Singleton to my LocationRepository :

@Singleton
class LocationRepository @Inject constructor(@ApplicationContext val context: Context)
Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @Singleton
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Charles