My app, Hearing Saver, registers a BroadcastReceiver to get the ACTION_HEADSET_PLUG<http://developer.android.com/reference/android/content/Intent.html#ACTION_HEADSET_PLUG>action. Because of a flag on this, the receiver cannot be registered via the AndroidManifest, so I need to keep a service alive to maintain it. This worked perfectly in 2.2 and 2.1, but in 2.3 (my nexus S), this doesn't work. After I initially start the service up that registers the receiver, it will work for roughly one hour, but after that my receiver will no longer receive the intent.
I have checked the logs, and my service's onDestroy is not called, so I haven't unregistered the receiver myself. I also see that there is some other component of Android getting the Intent, so I know it's being broadcast. I know that my process is not killed, and according to the manage apps settings screen, my service is still running. I have tried a few things to fix this, but nothing has helped. I have acquired a wakelock in my receiver because I thought maybe the Nexus S is just very aggressive about sleeping, no dice. I tried setting android:persistent="true" on a whim out of desperation, no dice. I am out of ideas as I believe my app's structure is correct. Does anyone have any ideas as to what is causing this difference in 2.3 from previous versions, and/or how I can correct/work around it? For your reference, here are the classes in question: - The Service<https://bitbucket.org/jakethecoder/hearing-saver/src/71dd4649acdd/src/com/jakebasile/android/hearingsaver/RegistrationService.java> - The BroadcastReceiver<https://bitbucket.org/jakethecoder/hearing-saver/src/71dd4649acdd/src/com/jakebasile/android/hearingsaver/UnplugReceiver.java> - The Manifest<https://bitbucket.org/jakethecoder/hearing-saver/src/71dd4649acdd/AndroidManifest.xml> -- 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

