Chris,

You have a MAIN/LAUNCHER intent filter for your widget configuration
activity.

This marks it as the entry point into your application, and it will be shown
in the application drawer (Launcher).

Is this what you really want?

If it's launched like this (as opposed to when you go through creating your
widget on the home screen), it won't have any widget specific action or
extras.

Launching for debugging from Eclipse will also start this activity using
MAIN/LAUNCHER, and it won't have any widget specific stuff either.

-- Kostya

2011/6/5 chris <[email protected]>

> Hello,
>
> I have been trying to implement an application that uses the
> ACTION_APPWIDGET_CONFIGURE action to configure an app when it is first
> installed.
>
> I have been using the discussion at
> http://developer.android.com/guide/topics/appwidgets/index.html#Configuring
> as a reference to accomplish this.
>
> The problem is that the onStart() process of the configuration
> activity does not ever receive an ACTION_APPWIDGET_CONFIGURE.  In
> other words the code snippet below always executes finish () because
> it is not a CONFIGURE action being processed.
>
> Is there a very simple app that demonstrates receiving an ACTION
> event, or is there an obvious problem with what I am doing?
>
> Thanks,
>
> Chris Newton
>
> ---------------- CODE SNIPPET -----------------------------
>
> public class TestConfigure extends Activity {
>
>        int appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
>
>        @Override
>        protected void onCreate(Bundle savedInstanceState)
>        {
>                super.onCreate(savedInstanceState);
>
>                // cause the widget host to cancel out of the widget
> placement if the back button is pressed.
>               setResult(RESULT_CANCELED);
>
>
>               Intent intent = getIntent();
>               Bundle extras = intent.getExtras();
>
>               if (extras != null)
>               {
>                     appWidgetId =
> extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID,
> AppWidgetManager.INVALID_APPWIDGET_ID);
>               }
>
>              // If they gave us an intent without the widget id, just
> bail.
>              if (appWidgetId ==
> AppWidgetManager.INVALID_APPWIDGET_ID)
>              {
>                   finish();
>              }
>
>        }
> }
>
> ---------------- AndroidManifest.xml
> ---------------------------------------
>
> <?xml version="1.0" encoding="utf-8"?>
> <manifest xmlns:android="http://schemas.android.com/apk/res/android";
>      package="com.darfield.test"
>      android:versionCode="1"
>      android:versionName="1.0">
>
>
>    <application android:icon="@drawable/icon" android:label="@string/
> app_name">
>
>                <receiver android:name="TestWidget" >
>                <intent-filter>
>                        <action
> android:name="android.appwidget.action.APPWIDGET_UPDATE" />
>                </intent-filter>
>                <meta-data android:name="android.appwidget.provider"
>                       android:resource="@xml/test_info" />
>                </receiver>
>
>        <activity android:name=".TestConfigure"
>                  android:label="@string/app_name">
>                        <intent-filter>
>                    <action
> android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
>                        </intent-filter>
>            <intent-filter>
>                <action android:name="android.intent.action.MAIN" />
>                <category
> android:name="android.intent.category.LAUNCHER" />
>            </intent-filter>
>        </activity>
>
>    </application>
> </manifest>
>
>
> ---------------------- test_info.xml
> ------------------------------------------
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/
> android"
>    android:minWidth="294dp"
>    android:minHeight="72dp"
>    android:updatePeriodMillis="86400000"
>    android:initialLayout="@layout/main"
>    android:configure="com.darfield.test.TestConfigure" >
> </appwidget-provider>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to