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!
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!
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();
}
}
What is the service doing? What about just setting up a receiver to listen to something the service uses to launch it instead?