Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6153861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:09:48+00:00 2026-05-23T20:09:48+00:00

my widget should refresh its textviews every day at 0:00. In the widget_provider.xml I

  • 0

my widget should refresh its textviews every day at 0:00. In the widget_provider.xml I set android:updatePeriodMillis="1000" but I read that the minimum update period is 30 minutes and I have to use alarmManager for this. So i want an alarm that triggers the refresh every day at 0:00. UpdateService.class handles the refreshing (setting texts for textviews based on date. The class is just not called until around half an hour after midnight)

In the public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) method I am using this code:

 Intent intentN = new Intent(context, UpdateService.class);
 PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
 AlarmManager alarmManager = (AlarmManager)getSystemService(context.ALARM_SERVICE);
 Calendar cal = Calendar.getInstance();
 cal.setTimeInMillis(System.currentTimeMillis());
 cal.add(Calendar.HOUR_OF_DAY, 0);
 cal.add(Calendar.MINUTE, 0);
 alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 24*60*60*1000, pendingIntent);

In the third line of the copied cut Eclipse says:

The method getSystemService(String) is undefined for the type HelloWidget

HelloWidget is the name of the AppWidgetProvider.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:09:49+00:00Added an answer on May 23, 2026 at 8:09 pm

    Did you try

    AlarmManager alarmManager = (AlarmManager)context.getSystemService(context.ALARM_SERVICE);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Android widget that contains two buttons. But i have no idea how
How should widgets in GWT inform other widgets to refresh themselfs or perform some
I am writing a test to see how event handlers should work but it
What should I return when overriding virtual bool Gtk::Widget::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) of Gtk::Widget? The
Note: As of Jellybean the gallery widget is deprecated. A ViewPager should be used
Which event from which widget should I catch when I need to run some
This is how I configure my APP's widget: <appwidget-provider xmlns:android=http://schemas.android.com/apk/res/android android:minWidth=240dp android:minHeight=193dp android:updatePeriodMillis=86400000 android:initialLayout=@layout/xyz_appwidget
I have an app with widget. Three buttons on widget should sent predefined SMS
The Widget we should use to show pictures is a QLabel. we can do
I have an app with a widget but I am having some difficulty with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.