Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Activity with no GUI

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

like image 680
Isaac Waller Avatar asked Feb 08 '09 17:02

Isaac Waller


People also ask

Is any activity possible in Android without UI?

Explanation. Generally, every activity is having its UI(Layout). But if a developer wants to create an activity without UI, he can do it.

Can we have activity without UI?

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.

Can activity run in background Android?

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.


1 Answers

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"> 
like image 183
JoeHz Avatar answered Oct 08 '22 03:10

JoeHz