Yeah I figured that would help things out, since a service should have a lot longer lifecycle then an activity. This has worked - to an extent, apart from randomly the observer will randomly stop responding and I cant see a way of detecting when this has happened!
On Jul 10, 6:08 pm, Streets Of Boston <[email protected]> wrote: > I'm not sure at all if this would work, > but have you tried to put the content-observer code inside a *service* > (instead of in your activity). > > Start the service and keep it around. > And if the content changes, create a notification. > The notification can be noticed by the user and allows him/her to > start your activity. > > On Jul 10, 10:14 am, "[email protected]" > > <[email protected]> wrote: > > Hey guys, > > > Quick question: I am trying to make a permanent contentObserver that > > observes content://sms. The way I do it atm is have an initial > > configure Activity with my application that calls the following code: > > > ContentResolver contentResolver = getContentResolver(); > > SMSHandler handler = new SMSHandler(); > > SMSObserver resolver = new SMSObserver(handler); > > resolver.setApplication(this.getApplication()); > > > > contentResolver.registerContentObserver(Uri.parse("content://sms"), > > true, resolver); > > > Now this all works fine...for a while; it seems that about 20 minutes > > after exiting said activity the ContentObserver will get removed and I > > will need to re-launch the Configure Activity to re-attach it. > > > Is there any way that I can make sure that this content observer can > > permanently listen for changes without ever being killed? > > > Thanks in advance! > > > -James --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

