Re: [android-developers] ACTION_APPWIDGET_CONFIGURE not being received

2011-06-09 Thread Chris Newton
Kostya,

Thanks for the reply.

I only added the MAIN/LAUNCHER activity because the app was not receiving the 
CONFIGURE action.  I have only been working with the application using the 
Eclipse environment, and from what you have just said perhaps this is my 
problem?  I will have to try making and installing the app without Eclipse in 
the equation.

For the time being I have rewritten the app as an activity, and will sort out 
the issues I am experiencing with launching it later (hopefully when I have 
learned more).

Thanks again,

Chris

On 2011-06-06, at 3:00 AM, Kostya Vasilyev wrote:

 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 northriverlogho...@gmail.com
 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=8640
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 android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 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 

Re: [android-developers] ACTION_APPWIDGET_CONFIGURE not being received

2011-06-09 Thread Kostya Vasilyev
No, I don't mean that launching from Eclipse, in itself, is the problem.

Let me try to clarify:


A widget configuration activity is started by Android when the user begins
creating a widget. It is passed the new widget id it's supposed to
configure.

I have code in one of my widgets that's just like yours, to get the widget
id from the extras, it works without any issues. Don't see anything wrong
with your XML code either.


On the other hand, since your activity has the MAIN/LAUNCHER filter, it can
be started from the app drawer (list of installed applications) or - and
this is where Eclipse comes into play - when you click Start debugging for
your project. In this case, since it's not being started as part of the
widget creation sequence, it won't have the widget id in its extras.


The configuration activity will only have the widget id extra if
it's started as part of the widget creation sequence. So, once you get the
application set up for debugging, switch to the home screen and create your
widget.


OTOH, I see this in your original email: to configure an app when it is
first installed. If you don't mean configuring a home screen widget, then
I'm a bit lost.


-- Kostya


2011/6/9 Chris Newton ch...@darfieldearthship.com

 Kostya,

 Thanks for the reply.

 I only added the MAIN/LAUNCHER activity because the app was not receiving
 the CONFIGURE action.  I have only been working with the application using
 the Eclipse environment, and from what you have just said perhaps this is my
 problem?  I will have to try making and installing the app without Eclipse
 in the equation.

 For the time being I have rewritten the app as an activity, and will sort
 out the issues I am experiencing with launching it later (hopefully when I
 have learned more).

 Thanks again,

 Chris

 On 2011-06-06, at 3:00 AM, Kostya Vasilyev wrote:

 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 northriverlogho...@gmail.com

 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
  

[android-developers] ACTION_APPWIDGET_CONFIGURE not being received

2011-06-06 Thread chris
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=8640
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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] ACTION_APPWIDGET_CONFIGURE not being received

2011-06-06 Thread Kostya Vasilyev
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 northriverlogho...@gmail.com

 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=8640
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 android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en