• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

AppWidget problem

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I'm new to the android platform and am reading the book Android application development for dummies, sorry if this is a silly question!

My problem:

From my understanding (refering to the code below), when the app widget updates itself,

1. the onUpdate() method is called

2. an explicit intent starts a toggleService

3. onHandleIntent() method in toggleService is called

4. Line 47-53 executes, causing the phone to be turned to normal mode if it was in silent mode and vice versa if the opposite was true.

So i changed the updatePeriodMillis value to 100 but the phones ringing mode wasn't changing every minute.

I know this is the desired outcome but would like to understand why the ringing mode doesn't change every minute.


After reading up on the Android developers website I was wondering if the update intent and any incoming intents must pass through the onReceive() method first.

Then, since the intents that should trigger the toggle service should have no action data, line 19 would be executed only for such intents.

Does this meant that update intents have action data? And if line 21 is executed, will onUpdate() run after that?

(public abstract void onReceive (Context context, Intent intent)
Since: API Level 1

This method is called when the BroadcastReceiver is receiving an Intent broadcast. During this time you can use the other methods on BroadcastReceiver to view/modify the current result values.)


Thanks in advance to anyone patient enough to help with this noobish problem x).


 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think AppWidgets will not get updated more often than once every 30 minutes. If you need more frequent updates you need to set up a repeating alarm using the AlarmManager, and then handle the alarm intent in your widget's onReceive method.
 
Jeremy Lee
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply Mr Dittmer, that wasn't what i meant to ask though, am aware about the AlarmManager class.

Think my question was too vague.

Shall go read up more, thanks anyway!
 
If a regular clown is funny, then a larger clown would be funnier. Math. Verified by this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic