I've read multiple clean architecture tutorials for android, but all of them had very basic structure with simple network calls which leaves me wondering.
What I want to know is where should I put code that handles accelerometer, geofencing, location, sms and similar? My initial thought was to put them in separate repositories. But as these are separate long running processes that could be started or stopped, it just doesn't feel right. I've tried renaming these classes from repository to service, just so the intent would be more clearly expressed. But still seems a bit off. What would be a good alternative?
To be able to receive sent sms status, I need to register a receiver. Who should be responsible for that? Would the repository itself, upon receiving a call to sendSms(), should register that receiver, send message and release receiver, or would a UseCase first would have to check if SmsRepository is started, and if not would start it, thus registering receiver, and then call the sendSms() method? Or maybe there should be another approach taken to register receiver on app start and unregister on close?
Is this an appropriate package structure?
EDIT: 4. What to do in case you want to constantly listen for server result? Do you directly subscribe to repository from viewmodel or do you keep calling same usecase (whose purpose is to fetch result once) after it finishes? My understanding of UseCase is that it only returns single result and is not supposed to be subscribable.