Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a Widget only application in Android?

To clarify the question:

I have seen multiple Apps in the Playstore that are widget only Apps without visible activities. I tried to create one myself but I need to define a launcher Activity. Once I use the configuration Activity of the Widget as a launcher the app becomes visible in the app overview in Android.

https://i.sstatic.net/jLUUd.png

If I dont define a launcher Activity I cant even deploy the app on the emulator.

The developerguide on https://developer.android.com/guide/topics/appwidgets/index.html about Widgets isnt really clear about how to handle this case.

Any help or directions where to find information is appreciated.

like image 796
Patric Avatar asked Sep 12 '26 00:09

Patric


1 Answers

If you want to create a widget only android application without any activity. You don't have to declare any intents for your activity. Just pass the intent filter for android.appwidget.action.APPWIDGET_CONFIGURE It will make the activity load when the user adds it to their home screen. Now you can simply declare your configuration class with your widget layout xml file with android:configure attribute liking to the class file the widget runs on.

Hope this helps.

like image 67
Harman Kamboj Avatar answered Sep 14 '26 16:09

Harman Kamboj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!