Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Service outlives parent application on Google Glass?

I have a service that is running in the same process.

    <service
        android:name=".service.GlassService"
        android:exported="true"
        android:label="@string/app_name" />

I start the service using startService().

        startService(new Intent(this, GlassService.class));

When I swipe down and exit the application, service lives on. When I kill it from DDMS, service is restarted, calling service with START_STICKY nor START_NOT_STICKY don't make a difference.

The only way I can stop service is when I explicitly call stopService() or stopItself() or omitting startService().

This is not the case on other android devices. Is this behavior typical for Google Glass ?

like image 338
jellyfication Avatar asked Mar 19 '14 10:03

jellyfication


1 Answers

That is typically why people use services. They are long running processes that are usually used to do background processing or for syncing data from a content provider. So it's easily an extension, that they can outlive their parent process.

Source:

  1. What you describe happens to my application too and it's run on a Normal Phone
  2. Says so in this Google documentation[docs][1] (Read the part about why services aren't a thread)

    [1]: http://developer.android.com/reference/android/app/Service.html

like image 90
user3182350 Avatar answered Nov 15 '22 07:11

user3182350