I have a widget that should start and stop the service (start it when it is not working, stop it when it is). This works fine, however, every time the service starts, the main application of my application also starts, which I don’t want. If I remove the MAIN-aim-filter ( <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> ) from the application manifest, it works the way I want (without starting the main activity, just a service), but then I obviously no longer have the main activity ...
This is how I start the service (I would suggest that this is the normal path, and I see no reference to what might lead to the main intention):
Intent svc = new Intent(this, OnOffService.class); startService(svc);
Thanks,
Nick
source share