all tutorials tell me to do this:
startService(new Intent(this, MyService.class));
but there is no constructor that takes Activity, Class and so i get syntax errors
http://developer.android.com/reference/android/content/Intent.html
I am attempting to spawn a service this way,
startService(new Intent(getApplicationContext(), MyService.class));
but my service never executes.
public class MyService extends IntentService {
public MyService() {
super("MyService");
}
@Override
protected void onHandleIntent(Intent intent) {
//do stuff
}
}
how can i spawn a service?
ANSWER: my android manifest didnt specifcy package
Actual problem (as found in comments) added here :
The service was in a different package, so in the manifest it has to be fully qualified, e.g.
<service android:name="actual.package.of.MyService"/>Old Answer:
If you try to launch the service in an inner class, you should not write:
But:
Make sure your service appears in the manifest.
onHandleIntentto see whether it starts or not.