Re: [android-developers] Re: Scheduling ideas
That is not an activity that extends a Broadcast receiver. That is a class that extends a Broadcast receiver, making AlarmReceiver a broadcast receiver, not an Activity. On Thu, Feb 24, 2011 at 1:27 PM, Neilz neilhorn...@gmail.com wrote: Like this: public class AlarmReceiver extends BroadcastReceiver { On Feb 23, 10:11 pm, Kostya Vasilyev kmans...@gmail.com wrote: 24.02.2011 1:06,Neilzпишет: I'm using an Activity that extends a BroadcastReceiver... An Activity that extends a Broadcast receiver? Sorry, I'm not sure I understand what this means. Do you mean something else - like a BroadcastReceiver subclass that starts an Activity subclass? -- Kostya Vasilyev --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scheduling ideas
Ok, that's a receiver. I am guessing that your receiver uses startActivity. If you do that, beware of sleep/wake states, it's documented here: http://developer.android.com/reference/android/app/AlarmManager.html Android guarantees that for Wakeup-type alarms delivered to a broadcast receiver, it will keep the device from falling back to sleep only for the duration of the receiver's onReceive. If that's too short, and your code needs to do more, especially an asynchronous operation (such as starting an Activity or a Service), then it's up to your code to acquire a WakeLock to keep the device awake as long as needed for that. There is an example at the top of this page: http://developer.android.com/reference/android/os/PowerManager.html Basically, the structure should be - onReceive() Call startService or startActivity Acquire a WakeLock [return] --- lock is held, device is still awake --- Android processes startActivity call Your activity is created and started onResume releases the wake lock so it's not held forever Somewhere in there should be some kind of error handling, so that if something goes wrong, the device is not held awake indefinitely (or rather, until the battery runs out - which won't be long). -- Kostya 24.02.2011 23:27, Neilz пишет: Like this: public class AlarmReceiver extends BroadcastReceiver { On Feb 23, 10:11 pm, Kostya Vasilyevkmans...@gmail.com wrote: 24.02.2011 1:06,Neilzпишет: I'm using an Activity that extends a BroadcastReceiver... An Activity that extends a Broadcast receiver? Sorry, I'm not sure I understand what this means. Do you mean something else - like a BroadcastReceiver subclass that starts an Activity subclass? -- Kostya Vasilyev --http://kmansoft.wordpress.com -- Kostya Vasilyev -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scheduling ideas
24.02.2011 1:06, Neilz пишет: I'm using an Activity that extends a BroadcastReceiver... An Activity that extends a Broadcast receiver? Sorry, I'm not sure I understand what this means. Do you mean something else - like a BroadcastReceiver subclass that starts an Activity subclass? -- Kostya Vasilyev -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scheduling ideas
If your device switches off the networking connection while sleeping, then yes, that line can throw an exception. It should be an IOException, which should go into the log, but since it doesn't seem to be - add a catch block for Exception (or even better, Throwable) and log it, see what happens. You could also log the current connectivity state just before opening the connection, just some additional information to see what's going on: ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); NetworkInfo connNetwork = cm.getActiveNetworkInfo(); Log.i(TAG, Active network info: + String.valueOf(connNetwork)); -- Kostya 20.02.2011 15:36, Neilz пишет: Reviving this thread yet again... There does seem to be some kind of bug in the code. Strange thing is though, it does get caught. The code always works fine within normal circumstances, but when it's run as an Alarm Service, the process dies at a particular line, and it isn't caught in the catch block. try{ URL updateURL = new URL(sUrl); conn = updateURL.openConnection(); ins = conn.getInputStream(); // this line causes the process to die }catch(IOException ioe){ Log.e(TAG, Error making URL request + ioe.getMessage()); // this is never shown throw ioe; } Any ideas why this would happen? On Feb 7, 9:41 am, Kostya Vasilyevkmans...@gmail.com wrote: Having said that, there may be a bug in your code. Since your code, AFAIK, schedules one alarm at a time, there may be a situation where the old alarm already fired (and forgotten), and the new one isn't scheduled. You should schedule the new alarm as soon as you receive the old one. Ideally, right inside onReceive for the old alarm's broadcast action, because onReceive is guaranteed to not be interrupted. -- Kostya -- Kostya Vasilyev -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scheduling ideas
20.02.2011 16:18, Neilz пишет: I did the network test... Active network info: NetworkInfo: type: WIFI[], state: CONNECTED/ CONNECTED, reason: (unspecified), extra: (none), roaming: false, failover: false, isAvailable: true That's good. And added a general Exception block, which still didn't catch anything! Try adding a catch for Throwable then - if you're getting a RuntimeError (like null pointer or something), that will get past a catch for Exception. Oh, and what do you see in the logcat? If this is a crash, there should be something there. -- Kostya Vasilyev -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scheduling ideas
This means Android decided to get rid your process, thinking it wasn't important. http://android-developers.blogspot.com/2010/02/service-api-changes-starting-with.html Add a call to startForeground while updating data, and stopForeground when done. And btw, you are using AlarmService to schedule updates, correct? -- Kostya 20.02.2011 16:35, Neilz пишет: Yep, added a Throwable block, still nothing. The only output I get is this: 02-20 13:33:26.067: INFO/ActivityManager(83): Process com.my.app.android.activity:remote (pid 4610) has died. -- Kostya Vasilyev -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scheduling ideas
No, AsyncTask has nothing to do with when your process is killed. In both ways -- it can not allow it to be killed, nor can it *prevent* it from being killed (having a Service, Activity, etc running is what lets the system know how important the process is to be kept around, and thus whether it will decide to kill it). On Sun, Feb 20, 2011 at 7:13 AM, Neilz neilhorn...@gmail.com wrote: Ok. I think I may have found one factor influencing this. I'm using ASyncTask to handle the thread. I've just been reading some blogs on this, and it seems it is hard coded to use the lowest priority, which means it may well be killed off when used on a device with low memory (like my Hero in this case). I think I'll try to implement my task using a different thread management, and set its priority higher. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scheduling ideas
Neil, A background service may be stopped by Android at its discretion. The beauty of AlarmManager is that it doesn't matter - when an alarm fires, the component that the pending intent is intended for will be started as necessary. The alarms are not kept in the application's process, they are kept inside an Android component. You can verify your alarms by running dumpsys alarm (singular) in the adb shell. Having said that, there may be a bug in your code. Since your code, AFAIK, schedules one alarm at a time, there may be a situation where the old alarm already fired (and forgotten), and the new one isn't scheduled. You should schedule the new alarm as soon as you receive the old one. Ideally, right inside onReceive for the old alarm's broadcast action, because onReceive is guaranteed to not be interrupted. -- Kostya 07.02.2011 12:21, Neilz пишет: More issues with this. I'm testing on a Nexus and Hero. It all runs fine on the Nexus, but on the Hero after I schedule the alarm, sometimes the process seems to die: 02-07 09:00:36.664: INFO/ActivityManager(98): Process com.my.app.activity:remote (pid 1813) has died. And that's it, no other log messages. So my alarm fails, and I never know about it until I find it didn't run the next morning. Any ideas why this would happen, or ways to stop this? -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scheduling ideas
Yes, this was discussed recently here: http://code.google.com/p/android/issues/detail?id=14536 and there appears to be no workaround, except explaining this to the user (in the application's UI or if he contacts you). I was just saying that there are devices out there with pretty weird quirks. -- Kostya 06.02.2011 12:52, Neilz пишет: Really, BOOT_COMPLETED can be disabled? That poses me a bit of a problem. So there's no way for me to know whether my alarm service has been restarted. On Feb 5, 4:01 pm, Kostya Vasilyevkmans...@gmail.com wrote: Well, some devices have really weird settings, like the HTC fast boot optimization for the Desire HD, which disables BOOT_COMPLETED. So at least you can be aware of it. ger + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scheduling ideas
On 5 February 2011 13:40, Neilz neilhorn...@gmail.com wrote: Ok, one problem with this alarm service. I schedule it for some time in the morning, and when I get up and check the phone, the alarm didn't get called, because it thinks there's no network connection. Alarm manager makes does not care network connection. It fires alarms based on device's RTC and that's all it does. So alarm most likely was fired correctly, yet your fired code failed to operate - and this is slightly different thing. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scheduling ideas
05.02.2011 15:40, Neilz пишет: Ok, one problem with this alarm service. I schedule it for some time in the morning, and when I get up and check the phone, the alarm didn't get called, because it thinks there's no network connection. I'm sure the alarm did get called, as the AlarmManager service has nothing to do with networking. This is a call I make deliberately (I always check there's a connection before making the server request)... but why does it think there's no network when the phone is 'sleeping'? The connection is still there... Depends on what kind of network connectivity you expect. In my tests (Moto Milestone), WiFi doesn't get enabled when the phone is woken by an alarm, but the cellular data connection is available immediately. -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scheduling ideas
Neil, That's pretty much how I test too, except my code lacks a check for isConnected, only for null. This is what I get in my app's log: NetworkInfo: type: MOBILE[EDGE], state: CONNECTED/CONNECTED, reason: apnSwitched, extra: internet.mts.ru, roaming: false, failover: false, isAvailable: true Two ideas: - Check your phone settings, perhaps yours has some kind of sleep policy for mobile data; - Log the value you get by calling getActiveNetworkInfo into a file, and examine later. -- Kostya 05.02.2011 16:20, Neilz пишет: Hi Kostya. Yes, the alarm gets called... it's just my own call which stops it doing it's task. For example: if(isNetworkAvailable(mContext)){ // do stuff... } public static boolean isNetworkAvailable(Context context) { ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = connMgr.getActiveNetworkInfo(); return(info != null info.isConnected()); } So this call tells me the network isn't available when the phone's asleep. I guess I'll have to try another way of testing for the network? On Feb 5, 1:07 pm, Kostya Vasilyevkmans...@gmail.com wrote: 05.02.2011 15:40, Neilz пишет: Ok, one problem with this alarm service. I schedule it for some time in the morning, and when I get up and check the phone, the alarm didn't get called, because it thinks there's no network connection. I'm sure the alarm did get called, as the AlarmManager service has nothing to do with networking. This is a call I make deliberately (I always check there's a connection before making the server request)... but why does it think there's no network when the phone is 'sleeping'? The connection is still there... Depends on what kind of network connectivity you expect. In my tests (Moto Milestone), WiFi doesn't get enabled when the phone is woken by an alarm, but the cellular data connection is available immediately. -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scheduling ideas
On Sat, Feb 5, 2011 at 10:22 AM, Neilz neilhorn...@gmail.com wrote: Yes, looking at the log output, it seems the device disables the wireless connection after a few minutes while the phone's sleeping, to save resources I suppose. So I'll just have to code around that, and reset the alarm to try again until the connection is back. If by wireless connection you mean WiFi, yes, the WiFi radio gets turned off while the phone is asleep. You will need to maintain a WakeLock and a WiFiLock. And, bear in mind that the user may or may not have an available WiFi connection wherever they happen to be. If by wireless connection you mean mobile data, AFAIK that remains on even while the device is asleep. In fact, one of the things that can wake up the device is an incoming packet on an open socket on a 3G connection. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.4 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scheduling ideas
Interesting. I take it by wireless you mean cellular? My HTC Hero has an option for always on cellular data connection - I guess it's specific to HTC phones, as neither my Samsung Galaxy S or Motorola Milestone have that. Is your phone made by HTC by any chance? If so, perhaps you could check that setting. -- Kostya 05.02.2011 18:22, Neilz пишет: Yes, looking at the log output, it seems the device disables the wireless connection after a few minutes while the phone's sleeping, to save resources I suppose. So I'll just have to code around that, and reset the alarm to try again until the connection is back. On Feb 5, 1:29 pm, Kostya Vasilyevkmans...@gmail.com wrote: Neil, That's pretty much how I test too, except my code lacks a check for isConnected, only for null. This is what I get in my app's log: NetworkInfo: type: MOBILE[EDGE], state: CONNECTED/CONNECTED, reason: apnSwitched, extra: internet.mts.ru, roaming: false, failover: false, isAvailable: true Two ideas: - Check your phone settings, perhaps yours has some kind of sleep policy for mobile data; - Log the value you get by calling getActiveNetworkInfo into a file, and examine later. -- Kostya 05.02.2011 16:20, Neilz пишет: Hi Kostya. Yes, the alarm gets called... it's just my own call which stops it doing it's task. For example: if(isNetworkAvailable(mContext)){ // do stuff... } public static boolean isNetworkAvailable(Context context) { ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = connMgr.getActiveNetworkInfo(); return(info != nullinfo.isConnected()); } So this call tells me the network isn't available when the phone's asleep. I guess I'll have to try another way of testing for the network? On Feb 5, 1:07 pm, Kostya Vasilyevkmans...@gmail.comwrote: 05.02.2011 15:40, Neilz пишет: Ok, one problem with this alarm service. I schedule it for some time in the morning, and when I get up and check the phone, the alarm didn't get called, because it thinks there's no network connection. I'm sure the alarm did get called, as the AlarmManager service has nothing to do with networking. This is a call I make deliberately (I always check there's a connection before making the server request)... but why does it think there's no network when the phone is 'sleeping'? The connection is still there... Depends on what kind of network connectivity you expect. In my tests (Moto Milestone), WiFi doesn't get enabled when the phone is woken by an alarm, but the cellular data connection is available immediately. -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scheduling ideas
05.02.2011 18:47, Neilz пишет: No I'm testing on a Nexus... Ok. But I can't be responsible for user's individual settings, so I'll just have to assume that in some cases the network will not be available during the night. Unless there's a command to explicitly wake up the connection? Well, some devices have really weird settings, like the HTC fast boot optimization for the Desire HD, which disables BOOT_COMPLETED. So at least you can be aware of it. But since your phone is not an HTC There is this: http://developer.android.com/reference/android/net/ConnectivityManager.html#setNetworkPreference(int) but i haven't had much experience with it, since my phone keeps the mobile connection on at all times, as seen in the log entry I posted before. What happens if you just go ahead and start your network operation? Might cause the phone establish a connection just then, on demand. If not, I suppose your code catches IOException already, right? -- Kostya On Feb 5, 3:42 pm, Kostya Vasilyevkmans...@gmail.com wrote: Interesting. I take it by wireless you mean cellular? My HTC Hero has an option for always on cellular data connection - I guess it's specific to HTC phones, as neither my Samsung Galaxy S or Motorola Milestone have that. Is your phone made by HTC by any chance? If so, perhaps you could check that setting. -- Kostya 05.02.2011 18:22, Neilz пишет: Yes, looking at the log output, it seems the device disables the wireless connection after a few minutes while the phone's sleeping, to save resources I suppose. So I'll just have to code around that, and reset the alarm to try again until the connection is back. On Feb 5, 1:29 pm, Kostya Vasilyevkmans...@gmail.comwrote: Neil, That's pretty much how I test too, except my code lacks a check for isConnected, only for null. This is what I get in my app's log: NetworkInfo: type: MOBILE[EDGE], state: CONNECTED/CONNECTED, reason: apnSwitched, extra: internet.mts.ru, roaming: false, failover: false, isAvailable: true Two ideas: - Check your phone settings, perhaps yours has some kind of sleep policy for mobile data; - Log the value you get by calling getActiveNetworkInfo into a file, and examine later. -- Kostya 05.02.2011 16:20, Neilz пишет: Hi Kostya. Yes, the alarm gets called... it's just my own call which stops it doing it's task. For example: if(isNetworkAvailable(mContext)){ // do stuff... } public static boolean isNetworkAvailable(Context context) { ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = connMgr.getActiveNetworkInfo(); return(info != null info.isConnected()); } So this call tells me the network isn't available when the phone's asleep. I guess I'll have to try another way of testing for the network? On Feb 5, 1:07 pm, Kostya Vasilyevkmans...@gmail.com wrote: 05.02.2011 15:40, Neilz пишет: Ok, one problem with this alarm service. I schedule it for some time in the morning, and when I get up and check the phone, the alarm didn't get called, because it thinks there's no network connection. I'm sure the alarm did get called, as the AlarmManager service has nothing to do with networking. This is a call I make deliberately (I always check there's a connection before making the server request)... but why does it think there's no network when the phone is 'sleeping'? The connection is still there... Depends on what kind of network connectivity you expect. In my tests (Moto Milestone), WiFi doesn't get enabled when the phone is woken by an alarm, but the cellular data connection is available immediately. -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scheduling ideas
Right, alarms are not persistent. Implement a receiver for android.intent.action.BOOT_COMPLETED, and set the alarm again after the device reboots. -- Kostya 01.02.2011 20:22, Neilz пишет: Thanks... this seems to be what I'm after. However I just put together a simple repeat alarm, outputting a Toast every minute, which was fine. But it didn't work again after a phone restart... how can this be implemented? -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scheduling ideas
01.02.2011 20:35, Neilz пишет: Right, thanks. And will that stay on the device as long as the app is still installed? Yes. (And, I suppose, will it get removed if the app is uninstalled?) Believe so. -- Kostya On Feb 1, 5:25 pm, Kostya Vasilyevkmans...@gmail.com wrote: Right, alarms are not persistent. Implement a receiver for android.intent.action.BOOT_COMPLETED, and set the alarm again after the device reboots. -- Kostya 01.02.2011 20:22, Neilz пишет: Thanks... this seems to be what I'm after. However I just put together a simple repeat alarm, outputting a Toast every minute, which was fine. But it didn't work again after a phone restart... how can this be implemented? -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Scheduling ideas
Neil, You can set a non-repeating RTC or RTC_WAKEUP alarm at a fixed time, then when it fires, set the next one. Rinse, repeat :) -- Kostya 02.02.2011 0:22, Neilz пишет: One thing I'm unsure of is how to schedule an alarm for a certain time, like 8am every day. All I can see is setting a repeat, at an interval of x milliseconds. Ok, so I can say one day's worth of milliseconds, but that's placing a lot of trust on the system clock? I can see that going wrong somehow... On Feb 1, 5:55 pm, Kostya Vasilyevkmans...@gmail.com wrote: 01.02.2011 20:35, Neilz пишет: Right, thanks. And will that stay on the device as long as the app is still installed? Yes. (And, I suppose, will it get removed if the app is uninstalled?) Believe so. -- Kostya On Feb 1, 5:25 pm, Kostya Vasilyevkmans...@gmail.comwrote: Right, alarms are not persistent. Implement a receiver for android.intent.action.BOOT_COMPLETED, and set the alarm again after the device reboots. -- Kostya 01.02.2011 20:22, Neilz пишет: Thanks... this seems to be what I'm after. However I just put together a simple repeat alarm, outputting a Toast every minute, which was fine. But it didn't work again after a phone restart... how can this be implemented? -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en