android - Keep BroadcastReceiver on configuration change -


i'm perhaps thinking wrong... i'm using background service in application track location updates frequently.

since there exists possibility location client can disconnect or connection can fail have in these methods (in service) implemented intent broadcast message new intent(broadcast_connection_failed); when received app can take appropriate actions (like update gui tracking turned off , on)

so i've done far register connection failed receiver inside activity when gps service turned on, not unregister when app goes background (since want receive broadcasts in background). creates problem me because whenever configuration changed (screen rotating etc.) try register connection failed receiver again (and since it's registered) throw exception (activity com.bla.bla.mainactivity has leaked intentreceiver...)

so regarding how should elegantly solve this?


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -