Reputation: 25761
My application is basically a service, i.e. has no UI (there isn't any class subclassing Activity). I want to have it displayed in the list of applications and to run the service when it's started from there, with the advantage that the user can create a shortcut to display it in the home screen.
Is this possible?
Upvotes: 2
Views: 1481
Reputation: 25761
Found the solution to this:
Activity
and in the onCreate(...)
method call your service and then call finish()
.To prevent the flashing of the Activity
opening and closing, use this as the theme of your Activity
(in the AndroidManifest.xml):
android:theme="@android:style/Theme.Translucent.NoTitleBar"
Upvotes: 2
Reputation: 1006984
I want to have it displayed in the list of applications and to run the service when it's started from there, with the advantage that the user can create a shortcut to display it in the home screen.
That is not a "list of applications". It is a list of activities that have advertised via <intent-filter>
that they are to appear in the launcher. The key word is "activities".
Creating a dummy Activity that starts the service and then finishes itself does the trick, but I'm a little worried about the flashing of the Activity loading and closing.
Then create an activity that adds value to the user.
Upvotes: 1
Reputation: 29912
Just make one Activity that allows the user to configure your application. Also there surely must be some sort of UI as part of the app. Otherwise what is it actually doing and how does the user control it?
Upvotes: 1