Is it possible to start a service with a shortcut?

android

Solution

You can create a dummy Activity that simply starts a Service, then finishes itself:

public class MyServiceActivity extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Intent intent = new Intent(this, MyService.class);
        startService(intent);
        finish();
    }
}

Problem

I'm trying to create a shortcut on the home screen that, when pressed, will start a service instead of an activity. Is it possible? How? Thanks!

Original source