It seems like a shame if you need to code around this, but you could do it a little cleaner, as you suggested. I would suggest you simply keep your own preference variable that records the 'last' state it knew about defaulting it to idle when your application first initializes. Then on the state change simply check the state is different from before before you take any action on the state change. This is mostly the same approach as you proposed with the benefit it treats all state changes as suspect. This gives a more robust error checking if any other state change quirks happen in which you might get duplicate notifications.
Still I don't like the idea you have to have that persistent variable, at least this solution has a tad more purpose. On Nov 4, 8:32 am, Tabibito <[email protected]> wrote: > What I mean is that I start the service when I receive a > "BOOT_COMPLETED" message from the system. Immediately upon starting > my service, onCallStateChanged() is called with a state of "idle". No > calls have come in, I haven't even touched the emulator... I'm > assuming that it's happening because the call state started out as > undefined, and when the system got around to filling it in with > "idle", my service was already listening, and therefore got notified > of the change (this is only a guess - I could be way off on this...). > If I could figure out what it changed FROM, that would be useful. I > could also probably sense this initial anomaly with some sort of > persistent state variable, and the first time onCallStateListener is > called, set the variable and ignore the state change, then every > future calling of onCallStateListener would look at that variable to > see if it was set... but that sounds like a really messy approach for > something that probably has a much cleaner solution. -- 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

