Updating a widget when screen is on - Android Software Development

Hi to everyone.
I'm doing a programable events countdown widget, that shows the countDown and the name of the event, but the minimum update frequency is about 30 minutes, and i want call to onUpdate everyTime the screen turns on, and i wish show the countdown in seconds too (refresh every second) I don't know if it is possible.
P.d. I saw some pages where people use an alarm to triger the call to the method (onUpdate) but i guess that it may be decrease the battery quickly is it?
Sorry for my indian english...
Enric

onUpdate() is only called when the android:updatePeriodMillis is up. you shouldnt try to call it from anywhere else. but since there is another method in AppWidgetProvider called onRecieve() that takes an Intent and a Context you can listen for the screen on intent or even the screen unlock intent and then start your countdown with an AlarmManager.
hope that guides you in the right direction

Related

What is "Today timeout"??

I have a MDA Vario. In SETTINGS --> TODAY --> ITEMS tab, what is "Today timeout", which is set at "4 hr" by default?? Does anyone know pls? I do not see any reference to it in the manual. Thx.
Tones
I think that's the amount of time after which it will return to the today screen if you left it with an app open and didn't touch it.
i tried it last night by leaving a game running, but it was still there when i got up the next day. it does seem to be the function u described, mate. Anyone else have any ideas pls?
A game will certainly work differently as it will request permanent focus and fullscreen. Just try with a standard app like calendar...
well, it was only a simple solitaire card game, but nonetheless I will try standard one like you suggested. But if this "timeout" function really is to return to TODAY screen, what is the real use of it? to timeout in 4 hours? and the longest possible time option is 12 hours.
Doesn't it simply stop refreshing the today screen (ie the clock and other values)?
It still refreshes the clock when you put it into sleep mode. However, after a number of hours it always takes some time for the clock to jump to the correct time.
It is the idle time before the Today screen is shown.
It's near useless, I almost always keep my today screen on anyway, because who wants to wait 4hours to see it
Use my TodayButton app if you want quick access to the Today screen...
V
personally, I always return to the TODAY screen anyway by shutting down applications after i'm done with them. I just thought this "timeout" thing was a sophisticated and useful function, but it turns out to be quite the opposite. But i will never understand why anyone want to design it to timeout in HOURS and not in minutes.
I'm the same, I shut down apps and always leave it on the Today screen!
V
vijay555 said:
Use my TodayButton app if you want quick access to the Today screen...
V
Click to expand...
Click to collapse
Doesn't the Red button do that anyway?
Nah, red button minimises apps to leave them running in the background (I think it actually just switches to the today screen). Some don't mind this, but for me, if I want the app open, I'll open it, and when I want it closed, I want it closed.
VJOkButt allows you to use the red button to minimse or close, and also properly close the phone to save around 3mb memory. But it does this sympathetically with the phone, so if you're in the phone, it hangs up, but otherwise it's a minimiser.
V
lolz
Morale of the story.... no one knows it. I always keep it disabled. So no big deal.
Had PDF softcopy of Reference Manual of my O2AL, and searched with no hint at all. Lets be it.....
I thought...
Guys,
I just stumbled upon this thread and thought it might be a good idea to get educated. I never knew it.
But this is what I thought - I thought it is the time slot to show appointments.
Means, if you chose a slot of 4 hours, and there are continuous meetings scheduled in your calender (and display of them enabled), then it would act like a rolling 4 hours window (read as slot).
Does this make sense? I never had so many appointmens, but always thought this was the use of it.
Comments please.

(app request/skin request) motivational screen

I have a kaiser and what I'm wanting is just a simple screen that will popup every time the backlight is turned on. I want to be able to edit the message that pops up so that I can put a motivational message. Right now the way I have it set up is so that the notes in my owner info pops up when I turn it on... and that works really well but it's not that pleasing to the eye. If it's possible could someone make a skin for that screen if it's easier than making an app. I'd do it myself but I'm mentally challenged in those areas.
Any suggestions are welcome. Thanks ahead of time. I hope this isn't posted in the wrong area.
just to add more flexibility, what about an app able to display images at set events? like before or aftert a notification pops out... before or after an application is executed... this way you could set it to display a custon image (maybe a gif animation) ater s2u2 is closed...
g-alarm.
In settings, you can set you own picture as a background.
I am set my point(target) foto as background, and every morning i "SEE" motivation and wake up.
Alsow you can use "Alarm notice" from Pocket Informant. You can wrate somesing, and set Time.
sory for my English ....

APP Suggestion 'Nap Alarms' Nap-Ster

In my proffesion I often need to take a nap on my break. At the moment I either set a task with reminder or reset my main alarams to go off in 1/2hr or 1hr.
What would be great is if I had access to an app that would launch maybe three large buttons. Each one can be edited to time frames of your choice i.e 20mins, 30mins, 45mins.
Once you have your set of buttons defined to time frames of your choice you could launch the app at anytime and press one of the buttons. Instantly the time on the button will start ticking down seconds by minutes. When the time is up it will launch the sound file of your choice.
If any clever developers could knock this up it would save me 1 or 2 minutes of my valuable nap time!
Not exactly what you're looking for, but G-Alarm has a "Quick Alarm" feature that allows you to set an alarm for e.g. 20 minutes in the future. It remembers the length you choose, so next time it will automatically default to 20 minutes (or whatever you had set the last time).

[BOUNTY] [PAID] Countdown time showing years, days, hours, minutes.

Bounty is $20. US, payable via PayPal.
I have an activity in my Android app that only needs to display one thing...a countdown timer. In my app there is a global variable called calculation_result. I need the calculation_result to be formatted into a running countdown that shows years:days:hours:minutes (no seconds) with a label over each one. I'd like it to display at the top of the screen and span the width (fill_parent).
So if the calculation_result was 35.5 (you can round the number to nearest tenth), that number would represent 35 years and 182.5 days and the countdown displayed in the new activity would start at 35:182:12:00 and begin counting down towards 0. Whenever the app is closed, the countdown would stop (so we're not always draining the battery), but the next time it launches, it would need to account for the time it was off. I would prefer that this time marker be stored as a variable to this activity if it can work that way. As an example, if the app were restated 25 days and 4 hours after being shut off from the previous display, it would start up showing 35:157:08:00, and continue displaying an active countdown as long as the app was running, even if the user navigates to another activity in my app. The countdown would only reset itself if the user changed the data used to create the calculation_result, which is stored as a preference and it's value should not be changed by the countdown timer.
I'm working in Eclipse (android 2.2) and would like to get the eclipse project from whoever does this.
EDIT:
This work has been done and PAID.

[Q] Screen on - New Activity created

Hi!
I've found a strange Activity behavior while programming a game for Android (currently with API level 8)
Following Situation:
The Main Activity only consinsts of one View on which the Game Thread draws all the sprites and stuff. In the manifest I checked android:multiprocess="false" and android:launchMode="singleInstance" for the Main Activity, so that Android only creates one instance of this activity, so you always come back to your left game after pressing the home button and starting the app again. This works great, but if I turn off the screen WHILE in game, and the activity is active, and turning it back on, Android creates another instance of the game (the Main Activity), so it starts over again.
So my question is, what could I do to prevent this and have the same behavior as if switched back to Home Screen before turning off the screen?
(The testing device is a HTC Desire HD with Android Revolution HD 5.1.7, if this is necessary information for helpers )
I hope someone here can help me!
I think you will have to listen for the screen off intent and handle this situation very explicitly. Maybe make the pause screen come up and then when it turns back on have your activity check for instances of itself and then deal with it.
Do you use static activities?
From something awesome
Thanks for your answer
The ScreenOff/On Intents method would be easy, but how can I recover the old Activity in the new one?
The Activity should be static, cause of the manifest properties, or not?
Another idea: In the onPause() Method queck if it was Screen off (with the corresponding intent) and 'call' the home button
Is this possible? And how could I realize this?
There is a way to use adb to send the home key press. And you can run adb on the phone with getRuntime().exec("adb keyevent xx")
Where xx is the home button constant
From something awesome
Thanks for your help!
But I made it now a much easier way...
One single 'moveTaskToBack()' in the onPause and everything works perfect!
Nice. Its always best to assume that android will do nothing to manage your app and to just do everything very explicitly
From something awesome

Categories

Resources