Starting a service from application class
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/7198863/can-i-startservice-from-applicationoncreate">Can I startService from Application#onCreate()?</a>  </p>
</blockquote>



<p>Can we start a service from the application class?</p>

<p>I want to start a service when my application starts. So instead of starting the service from the starting activity, can I use my application class for this? Thanks.</p>

<p>What I tried is Inside application class : </p>

<pre><code>public void onCreate() {
    super.onCreate();


    Log.i("Logger", "Service Starting");
    Intent errorLoggerService = new Intent(getApplicationContext(),
            ErrorLoggerService.class);
    getApplicationContext().startService(errorLoggerService);
}
</code></pre>
