I am tyring to add a widget to my Android app, but I can't figure out how to size the preview icon. The (outdated) docs says that I should use the Widget Preview in the emulator, but there is no such app since at least API 25. Here's my appwidget-provider xml:
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="272dp"
android:minHeight="56dp"
android:updatePeriodMillis="840000000"
android:previewImage="@drawable/widget_preview"
android:initialLayout="@layout/mtc_appwidget"
android:configure="com.mygreatapp.MtcAppWidgetProvider"
android:resizeMode="horizontal|vertical"
android:widgetCategory="home_screen">
I tried with different sizes, the last on I did was 40x40, but whenever I drag the widget to the home screen, the process crashes and the widget is never added to the home screen. This is what I find in Logcat:
2020-08-05 09:02:10.461 2312-2312/? E/Launcher: Error: appWidgetId (EXTRA_APPWIDGET_ID) was not returned from the widget configuration activity.
I am lost...