I have created a activity that is only meant to be launched from a link (using a intent filter.) I do not want this activity to have a GUI - I just want it to start a service and put a notification in the bar. I have tried to put the intent filter for the link in my service, but that does not work. Is there a better thing to do this that will answer to intent filters - or can I just make my activity not have a GUI?
Sorry if I'm being confusing, Isaac
Explanation. Generally, every activity is having its UI(Layout). But if a developer wants to create an activity without UI, he can do it.
The answer is yes it's possible. Activities don't have to have a UI. It's mentioned in the documentation, e.g.: An activity is a single, focused thing that the user can do.
However, activity can't be run unless it's on foreground. In order to achieve what you want, in onPause(), you should start a service to continue the work in activity.
Echoing previous response, you shouldn't use a broadcast receiver.
In the same situation, what I did was to declare the theme thusly:
<activity android:name="MyActivity" android:label="@string/app_name" android:theme="@android:style/Theme.NoDisplay">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With