Hi,
I have a very simple widget and I want it to be updated every 30
minutes.

So I extended AppWidgetProviders as follow,

public class Testwidget extends AppWidgetProvider {
int COUNT = 0;

@Override
public void onUpdate(Context context, AppWidgetManager
appWidgetManager,
        int[] appWidgetIds) {

    Log.d("WIDGET", "====================== UPDATED
======================");
    super.onUpdate(context, appWidgetManager, appWidgetIds);

    for(int _i=0; _i<appWidgetIds.length; _i++){
        int _widId = appWidgetIds[_i];

        COUNT+=1;

        RemoteViews _views = new RemoteViews(context.getPackageName(),
R.layout.widgetlayout);
        _views.setTextViewText(R.id.tvCount,String.valueOf(COUNT));

        appWidgetManager.updateAppWidget(_widId, _views);
    }
}
}

My menifest file is as follow,
<receiver android:name="Testwidget">
        <intent-filter>
            <action
android:name="android.appwidget.action.APPWIDGET_UPDATE"></action>
        </intent-filter>
        <meta-data android:name="android.appwidget.provider"
            android:resource="@xml/widgetinfo"></meta-data>
    </receiver>

And my widget information XML as follow
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/
android"
android:minWidth="272dp" android:minHeight="72dp"
android:updatePeriodMillis="1800000" android:initialLayout="@layout/
widgetlayout">

</appwidget-provider>

My Layout has a simple text view that shows counter.
When I place widget for the first time on screen, it shows 1 as per my
onUpdate method. But now it never call onUpdate method and my widget
never updates itself. Many people told me to set
android:updatePeriodMillis = 180000. I have also tried that but no
luck.

Am I missing something with this code?
Please help.


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