Android Services and Android LifeCycle handling -


i have created app use 2 activities such that:

1st activity main activity, & 2nd activity starts main activity using button.

now have started sound(using service) in main activity , want keep service alive long app alive want stop if app closes(by either pressing button or home button).

the problem when use onpause/onresume methods sound service stops when start 2nd activity.

anyone having idea how tackle it? in advance!

instead of using onresume() , onpause(), use onuserleavehint(). when call other activity add intent:

intent.addflags(intent.flag_activity_no_user_action); 

you can read more here: http://developer.android.com/reference/android/app/activity.html#onuserleavehint%28%29


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -