I have an activity that looks up telephone numbers inputted from the UI out of a local sqlite database that shows the originating city/state of the number. Part of the activity also consists of a service that listens for incoming and outgoing calls on the phone. When a call is made, or a call comes in, it displays a Toast message at the bottom of the screen with that number's city/state from the database. As far as I am aware, there is no way to achieve this functionality without making the service live forever. Right now I have an alarm setup to run every hour and restart the service if it has been killed. I remember an old app that worked this way called "missed call" which changed the notification LED color based on the message received (missed call, sms, email etc.). My question is, is there a better way to go about doing this? I know keeping services running forever is extremely frowned upon, but I don't see any other method unless I'm missing something.
Thanks!