First thanks for your quick responses. Second I have few more questions 1. in your second suggestion is it possible ( and if yes how) to end the service later ( by user request) 2. in your third suggestion is it possible to start the broadcast receiver by demand and the same question as in bullet 1 can i stop it later
On Apr 28, 5:22 pm, Mark Murphy <mmur...@commonsware.com> wrote: > zohar lerman wrote: > > Sorry for the misunderstanding but i am not using service. > > > As i said in the initial post "The Application contains one activity > > which includes 2 buttons ‘Start’ > > and ‘Stop’" > > Right. You cannot, should not, and must not leave a listener attached > after an activity ends. You will leak memory and cause your users > significant pain. > > Your options are: > > 1. Go with the earlier advice, unregister your listeners in onDestroy(), > and do not "listen the phone event even when the application is closed" > > 2. Use a service, have the service have your listener, and have the > service continue operating after the activities end > > 3. Listen for broadcast Intents for phone state changes, instead of > using a listener > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > Android Consulting:http://commonsware.com/consulting > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group > athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en