Re: [android-developers] Newbie: Widget onUpdate called only on creation

2011-03-25 Thread Filip Havlicek
Found that too, thought more like an official statement in 1.6 changes or
something like that :)

2011/3/24 Kostya Vasilyev kmans...@gmail.com

  This:


 http://groups.google.com/group/android-developers/browse_thread/thread/963a41b2be0ff545

 has evidence from this very list's Sterling Udell, whose code was affected
 starting with 1.6.

 The official documentation has been updated since then.

 -- Kostya

 24.03.2011 14:37, Filip Havlicek пишет:

 Didn't found any reliable source of the 1.6 claim during a quick search,
 but you are completely right about the 30 minute rule.

 2011/3/23 Kostya Vasilyev kmans...@gmail.com

 As of 1.6 (I believe) the updatePeriodMillis is forced to be at least 30
 minutes.

 -- Kostya



 --
 Kostya Vasilyev -- http://kmansoft.wordpress.com

  --
 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

Re: [android-developers] Newbie: Widget onUpdate called only on creation

2011-03-24 Thread Filip Havlicek
Didn't found any reliable source of the 1.6 claim during a quick search, but
you are completely right about the 30 minute rule.

2011/3/23 Kostya Vasilyev kmans...@gmail.com

 As of 1.6 (I believe) the updatePeriodMillis is forced to be at least 30
 minutes.

 -- Kostya

 23.03.2011 19:07, Eduardo Yáñez Parareda пишет:

  Hello, I'm developing my first widget so I've following Google
 tutorials, but I don't get it works as I expect, it only calls
 onUpdate when the widget is installed, but it isn't called again...

 code
 public class TestWidgetProvider extends AppWidgetProvider {
 // Log tag
 private static final String TAG = TestWidgetProvider;

 public void onUpdate(Context context, AppWidgetManager
 appWidgetManager, int[] widgetIds) {
 Log.d(TAG, onUpdate);
 final int N = widgetIds.length;

 // Por cada widget asociado al provider
 for (int i = 0; i  N; i++) {
 int widgetId = widgetIds[i];
 updateWidget(context, appWidgetManager, widgetId);
 }
 }

 static void updateWidget(Context context, AppWidgetManager
 appWidgetManager, int widgetId) {
 // Obtenemos las vistas del widget
 RemoteViews views = new RemoteViews(context.getPackageName(),
 R.layout.gpro_widget_layout);

 // Actualizamos el texto del widget
 long time = System.currentTimeMillis();
 String text = String.format(Hora: %d ms., time);
 views.setTextViewText(R.id.text, text);

 // Actualizar el widget
 appWidgetManager.updateAppWidget(widgetId, views);
 }
 }
 /code

 XML config files:

 /AndroidManifest.xml

 ?xml version=1.0 encoding=utf-8?
 manifest xmlns:android=http://schemas.android.com/apk/res/android;
package=com.elpaso.android.gpro.widget android:versionCode=1
android:versionName=1.0
uses-sdk android:minSdkVersion=7 /
uses-permission android:name=android.permission.INTERNET/uses-
 permission

application android:icon=@drawable/icon android:label=@string/
 app_name
receiver android:name=TestWidgetProvider
intent-filter
action
 android:name=android.appwidget.action.APPWIDGET_UPDATE /
/intent-filter
meta-data
 android:name=android.appwidget.provider
 android:resource=@xml/gpro_widget_provider_info /
/receiver
/application
 /manifest

 XML provider config:

 xml/gpro_widget_provider.xml

 appwidget-provider xmlns:android=http://schemas.android.com/apk/res/
 android
 android:minWidth=294dp
 android:minHeight=72dp
 android:updatePeriodMillis=5000
 android:initialLayout=@layout/gpro_widget_layout
 /appwidget-provider



 --
 Kostya Vasilyev -- http://kmansoft.wordpress.com


 --
 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

Re: [android-developers] Newbie: Widget onUpdate called only on creation

2011-03-24 Thread Kostya Vasilyev

This:

http://groups.google.com/group/android-developers/browse_thread/thread/963a41b2be0ff545

has evidence from this very list's Sterling Udell, whose code was 
affected starting with 1.6.


The official documentation has been updated since then.

-- Kostya

24.03.2011 14:37, Filip Havlicek пишет:
Didn't found any reliable source of the 1.6 claim during a quick 
search, but you are completely right about the 30 minute rule.


2011/3/23 Kostya Vasilyev kmans...@gmail.com mailto:kmans...@gmail.com

As of 1.6 (I believe) the updatePeriodMillis is forced to be at
least 30 minutes.

-- Kostya




--
Kostya Vasilyev -- http://kmansoft.wordpress.com

--
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

[android-developers] Newbie: Widget onUpdate called only on creation

2011-03-23 Thread Eduardo Yáñez Parareda
Hello, I'm developing my first widget so I've following Google
tutorials, but I don't get it works as I expect, it only calls
onUpdate when the widget is installed, but it isn't called again...

code
public class TestWidgetProvider extends AppWidgetProvider {
// Log tag
private static final String TAG = TestWidgetProvider;

public void onUpdate(Context context, AppWidgetManager
appWidgetManager, int[] widgetIds) {
Log.d(TAG, onUpdate);
final int N = widgetIds.length;

// Por cada widget asociado al provider
for (int i = 0; i  N; i++) {
int widgetId = widgetIds[i];
updateWidget(context, appWidgetManager, widgetId);
}
}

static void updateWidget(Context context, AppWidgetManager
appWidgetManager, int widgetId) {
// Obtenemos las vistas del widget
RemoteViews views = new RemoteViews(context.getPackageName(),
R.layout.gpro_widget_layout);

// Actualizamos el texto del widget
long time = System.currentTimeMillis();
String text = String.format(Hora: %d ms., time);
views.setTextViewText(R.id.text, text);

// Actualizar el widget
appWidgetManager.updateAppWidget(widgetId, views);
}
}
/code

XML config files:

/AndroidManifest.xml

?xml version=1.0 encoding=utf-8?
manifest xmlns:android=http://schemas.android.com/apk/res/android;
package=com.elpaso.android.gpro.widget android:versionCode=1
android:versionName=1.0
uses-sdk android:minSdkVersion=7 /
uses-permission android:name=android.permission.INTERNET/uses-
permission

application android:icon=@drawable/icon android:label=@string/
app_name
receiver android:name=TestWidgetProvider
intent-filter
action 
android:name=android.appwidget.action.APPWIDGET_UPDATE /

/intent-filter
meta-data android:name=android.appwidget.provider
android:resource=@xml/gpro_widget_provider_info /
/receiver
/application
/manifest

XML provider config:

xml/gpro_widget_provider.xml

appwidget-provider xmlns:android=http://schemas.android.com/apk/res/
android
android:minWidth=294dp
android:minHeight=72dp
android:updatePeriodMillis=5000
android:initialLayout=@layout/gpro_widget_layout
/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] Newbie: Widget onUpdate called only on creation

2011-03-23 Thread Kostya Vasilyev
As of 1.6 (I believe) the updatePeriodMillis is forced to be at least 30 
minutes.


-- Kostya

23.03.2011 19:07, Eduardo Yáñez Parareda пишет:

Hello, I'm developing my first widget so I've following Google
tutorials, but I don't get it works as I expect, it only calls
onUpdate when the widget is installed, but it isn't called again...

code
public class TestWidgetProvider extends AppWidgetProvider {
 // Log tag
 private static final String TAG = TestWidgetProvider;

 public void onUpdate(Context context, AppWidgetManager
appWidgetManager, int[] widgetIds) {
 Log.d(TAG, onUpdate);
 final int N = widgetIds.length;

 // Por cada widget asociado al provider
 for (int i = 0; i  N; i++) {
 int widgetId = widgetIds[i];
 updateWidget(context, appWidgetManager, widgetId);
 }
 }

 static void updateWidget(Context context, AppWidgetManager
appWidgetManager, int widgetId) {
 // Obtenemos las vistas del widget
 RemoteViews views = new RemoteViews(context.getPackageName(),
R.layout.gpro_widget_layout);

 // Actualizamos el texto del widget
 long time = System.currentTimeMillis();
 String text = String.format(Hora: %d ms., time);
 views.setTextViewText(R.id.text, text);

 // Actualizar el widget
 appWidgetManager.updateAppWidget(widgetId, views);
 }
}
/code

XML config files:

/AndroidManifest.xml

?xml version=1.0 encoding=utf-8?
manifest xmlns:android=http://schemas.android.com/apk/res/android;
package=com.elpaso.android.gpro.widget android:versionCode=1
android:versionName=1.0
uses-sdk android:minSdkVersion=7 /
uses-permission android:name=android.permission.INTERNET/uses-
permission

application android:icon=@drawable/icon android:label=@string/
app_name
receiver android:name=TestWidgetProvider
intent-filter
action 
android:name=android.appwidget.action.APPWIDGET_UPDATE /
/intent-filter
meta-data android:name=android.appwidget.provider
android:resource=@xml/gpro_widget_provider_info /
/receiver
/application
/manifest

XML provider config:

xml/gpro_widget_provider.xml

appwidget-provider xmlns:android=http://schemas.android.com/apk/res/
android
 android:minWidth=294dp
 android:minHeight=72dp
 android:updatePeriodMillis=5000
 android:initialLayout=@layout/gpro_widget_layout
/appwidget-provider




--
Kostya Vasilyev -- http://kmansoft.wordpress.com

--
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