[android-developers] Re: Difference between swiping in all apps menu and pressing back to exit

2016-01-04 Thread Doug
The service IS the app.  There is no service without an app process to host 
it.  When your app process is killed (and you can never prevent that from 
happening) the service and all other app components will go with it.  
Anything else would be impossible for Android to manage since it chooses 
not to support the idea of a user knowingly closing an app like users 
expect on desktop operating systems.

On Sunday, January 3, 2016 at 9:12:15 AM UTC-8, Nick Teo wrote:
>
> Ah yes you're totally right. I started it sticky and that's why it's 
> coming back to life. Is there a way to keep the service running after the 
> app itself is killed? If not I guess I'll have to store the list in 
> persistent memory and load it in when the service starts. 

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/6d5e73a2-b04b-47e3-a6dd-2ae20f47efe5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Re: Difference between swiping in all apps menu and pressing back to exit

2016-01-03 Thread Nick Teo
Ah yes you're totally right. I started it sticky and that's why it's coming 
back to life. Is there a way to keep the service running after the app itself 
is killed? If not I guess I'll have to store the list in persistent memory and 
load it in when the service starts. 

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/2534ea57-f3e1-4267-9b99-8deef2a60873%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Re: Difference between swiping in all apps menu and pressing back to exit

2016-01-02 Thread Doug
Dismissing an app in the task switcher is the same as killing it.  If your 
service comes back after that, then something started the process again.  
Maybe your service is "sticky" and got restarted.  There is no guarantee 
your app's process can survive anything, so you should persist any changes 
that you do not want to be potentially lost.

Doug

On Wednesday, December 30, 2015 at 7:29:43 PM UTC-8, Nick Teo wrote:
>
> Hi all,
>
> I'm working on a messaging app that starts a service in the background 
> that will receive messages from a Pebble smartwatch and then send out an 
> sms message. Right at this moment, I'm trying to make it so that the 
> service is always running in the background so that the user can always 
> send texts even if the app isn't actually open. There is a private local 
> variable in the service that contains the contacts that the user can send 
> texts to. When I press the back button to exit the app after setting the 
> contacts, the list persists and when I open the app again, I see the 
> contacts. If I open up the all apps menu thing and swipe the app to exit 
> it, the list is destroyed, however, I know the service is still running (I 
> get Toasts from the service). I was under the impression that swiping the 
> app closed and pressing the back button are the same. Are they not? Is 
> there a way to make it so that the local variable is never destroyed as 
> long as the service is running?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/018f21c0-cdd0-4b30-a131-c3069c81e3b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.