Home screen android widgets for kivy
For now this repo will contain Research on creating Android widgets.
i think it only needs it's java class - broadcast listener, editing AndroidMainfest and creating some xml files.
Will release a version when or if it's successful testing
From AndroidMainfest point to AppWidgetProviderInfo
The AppWidgetProviderInfo XML Will contain info about the widget, should be saved in res/xml/
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="40dp"
android:minHeight="40dp"
android:targetCellWidth="1"
android:targetCellHeight="1"
android:maxResizeWidth="250dp"
android:maxResizeHeight="120dp"
android:updatePeriodMillis="86400000"
android:description="@string/example_appwidget_description"
android:previewLayout="@layout/example_appwidget_preview"
android:initialLayout="@layout/example_loading_appwidget"
android:configure="com.example.android.ExampleAppWidgetConfigurationActivity"
android:resizeMode="horizontal|vertical"
android:widgetCategory="home_screen"
android:widgetFeatures="reconfigurable|configuration_optional">
</appwidget-provider>The AppWidgetProvider class handles widget broadcasts and updates the widget in response to widget lifecycle events.
Tags:
receiver
android:namespecifysAppWidgetProviderwhich should be combination of app name and package name, In my caseorg.laner.lan_ft.ExampleAppWidgetProvider"according to my last working receiverandroid:exportedremains False unless another process communicates with Listener( Not sure what it means i think another process apart from app)
intent-filter:
android:name="android.appwidget.action.APPWIDGET_UPDATEis required, specifies Broad Listener accepts theACTION_APPWIDGET_UPDATEbroadcast.
meta-data:
meta-data android:nameandroid:resourcepoints to location ofAppWidgetProviderInfoin resources folder
<receiver android:name="ExampleAppWidgetProvider"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/example_appwidget_info" />
</receiver>AppWidgetProvider class extends BroadcastReceiver class, i.e it's a child class:
It receives only the event broadcasts when widget is updated, deleted, enabled, and disabled.
Use method onUpdate which is called in every updatePeriodMillis
Widget layout - What will display
Need to learn more about layouts.
Needs to be saved in res/layout
From this stackoverflow answer AppWidgetProvider calls a Sticky Service