KDH0322
KDH0322

Reputation: 11

Why my launcher app widget configure not showing

Now I am developing android launcher. I made my own launcher widgets. When I add a launcher widget to screen, I expect configure activity but it goes wrong. (But other app widgets have no matter.)

host.startAppWidgetConfigureActivityForResult(activity, widgetId, 0, requestCode, null);
ExceptionHandler: handleException
    java.lang.IllegalArgumentException: Widget not bound 74
        at android.os.Parcel.createException(Parcel.java:1946)
        at android.os.Parcel.readException(Parcel.java:1910)
        at android.os.Parcel.readException(Parcel.java:1860)
        at com.android.internal.appwidget.IAppWidgetService$Stub$Proxy.createAppWidgetConfigIntentSender(IAppWidgetService.java:663)
        at android.appwidget.AppWidgetHost.startAppWidgetConfigureActivityForResult(AppWidgetHost.java:284)
        at com.freeme.launcher.compat.AppWidgetManagerCompatVL.startConfigActivity(AppWidgetManagerCompatVL.java:92)
        at com.freeme.launcher.Launcher.addAppWidgetImpl(Launcher.java:2607)
        at com.freeme.launcher.Launcher.addAppWidgetImpl(Launcher.java:2596)

Here is widget provider info.

<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:minWidth="@dimen/base_widget_size"
    android:minHeight="@dimen/base_widget_size"
    android:updatePeriodMillis="86400000"
    android:initialLayout="@layout/picture_app_widget_provider"
    android:configure="com.freeme.launcher.widget.configure.PictureAppWidgetProviderConfigureActivity"
    android:previewImage="@drawable/sample_photo_widget"
    android:resizeMode="vertical|horizontal"
    android:widgetCategory="home_screen"/>

And I ensure there is configure activity and is registered on AndroidManifest.xml

Manifest

Result: Showing "Launcher Widget Configure Activity"

Upvotes: 1

Views: 133

Answers (1)

schendes
schendes

Reputation: 11

Bind your widget first with appropriate permissions. You can't configure a widget that you don't have permissions to access. See the android guide: https://developer.android.com/develop/ui/views/appwidgets/host

Upvotes: 0

Related Questions