Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Service Won't Start
    text
    copied!<p>Strange problem I'm facing. I want to start a Service when my Activity is created. Here is my Service's code (very simple, as you'll see):</p> <pre><code>package com.nblmedia.service; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.util.Log; public class ServiceSynchro extends Service { public ServiceSynchro() { Log.i(XXX.LOG, "ServiceSynchro"); } @Override public IBinder onBind(Intent intent) { Log.i(XXX.LOG, "onBind"); // TODO Auto-generated method stub return null; } @Override public void onCreate() { // TODO Auto-generated method stub Log.i(XXX.LOG, "onCreate"); super.onCreate(); } @Override public void onDestroy() { Log.i(XXX.LOG, "onDestroy"); // TODO Auto-generated method stub super.onDestroy(); } } </code></pre> <p>In my AndroidManifest.xml I have declared the Service as follow :</p> <pre><code>&lt;service android:name=".ServiceSynchro"&gt;&lt;/service&gt; </code></pre> <p>Finaly, to start my Service, I call the startService method in the onCreate :</p> <pre><code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); startService(new Intent(UserMenuActivity.this, ServiceSynchro.class)); } </code></pre> <p>And nothing happens. If I check the device's running services, there are no service named ServiceSyncho running. If I check the Logcat, nothing is outputted. Same for the breakpoints, the app doesn't cycle thru the Service's lifecycle events. Any idea what could be my problem?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload