Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e5186065 authored by Scott Main's avatar Scott Main Committed by The Android Open Source Project
Browse files

AI 150538: add note that appwidget updates will wake the device and suggest an alarm

  BUG=1962600

Automated import of CL 150538
parent d88c36bb
Loading
Loading
Loading
Loading
+14 −2
Original line number Original line Diff line number Diff line
@@ -150,14 +150,26 @@ folder.</p>
      <code>(number of cells * 74) - 2</code><br/>
      <code>(number of cells * 74) - 2</code><br/>
    Following this formula, you should use 72 dp for a height of one cell, 294 dp and for a width of four cells.</p>
    Following this formula, you should use 72 dp for a height of one cell, 294 dp and for a width of four cells.</p>
  </li>
  </li>
  <li>The <code>updatePerdiodMillis</code> attribute defines how often the App Widget framework should
  <li>The <code>updatePeriodMillis</code> attribute defines how often the App Widget framework should
    request an update from the {@link android.appwidget.AppWidgetProvider} by calling the
    request an update from the {@link android.appwidget.AppWidgetProvider} by calling the
    {@link android.appwidget.AppWidgetProvider#onUpdate(Context,AppWidgetManager,int[])
    {@link android.appwidget.AppWidgetProvider#onUpdate(Context,AppWidgetManager,int[])
    onUpdate()} method. The actual update is not guaranteed to occur exactly on time with this value
    onUpdate()} method. The actual update is not guaranteed to occur exactly on time with this value
    and we suggest updating as infrequently as possible&mdash;perhaps no more than once an hour to 
    and we suggest updating as infrequently as possible&mdash;perhaps no more than once an hour to 
    conserve the battery. You might also allow the user to adjust the frequency in a 
    conserve the battery. You might also allow the user to adjust the frequency in a 
    configuration&mdash;some people might want a stock ticker to update every 15 minutes, or maybe 
    configuration&mdash;some people might want a stock ticker to update every 15 minutes, or maybe 
    only four times a day.</li>
    only four times a day. 
    	<p class="note"><strong>Note:</strong> If the device is asleep when it is time for an update 
    	(as defined by <code>updatePeriodMillis</code>), then the device will wake up in order 
    	to perform the update. If you don't update more than once per hour, this probably won't 
    	cause significant problems for the battery life. If, however, you need to update more 
    	frequently and/or you do not need to update while the device is asleep, then you can instead 
    	perform updates based on an alarm that will not wake the device. To do so, set an alarm with 
    	an Intent that your AppWidgetProvider receives, using the	{@link android.app.AlarmManager}. 
    	Set the alarm type to either {@link android.app.AlarmManager#ELAPSED_REALTIME} or 
    	{@link android.app.AlarmManager#RTC}, which will only
    	deliver the alarm when the device is awake. Then set <code>updatePeriodMillis</code> to 
    	zero (<code>"0"</code>).</p>
  </li>
  <li>The <code>initialLayout</code> attribute points to the layout resource that defines the
  <li>The <code>initialLayout</code> attribute points to the layout resource that defines the
    App Widget layout.</li>
    App Widget layout.</li>
  <li>The <code>configure</code> attribute defines the {@link android.app.Activity} to launch when
  <li>The <code>configure</code> attribute defines the {@link android.app.Activity} to launch when