Re: [android-developers] Re: Status Bar Notifications

2011-03-12 Thread Brad Stintson
Finally, My alarm is working with notifications. :)



Thanks all and special thanks to Kostya Vasilyev




On Sat, Mar 12, 2011 at 1:42 ,AM, Kostya Vasilyev wrote:

> 11.03.2011 23:10, Marcin Orlowski пишет:
>
>  - Connect to your phone/emulator with "adb shell", use "dumpsys power" to
>>> >  check your alarm after it's been set.
>>>
>> You probably meant "dumpsys alarm"?
>>
>
> Yes, I did. Thanks.
>
>
> --
> 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: Status Bar Notifications

2011-03-11 Thread Kostya Vasilyev

11.03.2011 23:10, Marcin Orlowski пишет:

- Connect to your phone/emulator with "adb shell", use "dumpsys power" to
>  check your alarm after it's been set.

You probably meant "dumpsys alarm"?


Yes, I did. Thanks.

--
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: Status Bar Notifications

2011-03-11 Thread Marcin Orlowski
> - Connect to your phone/emulator with "adb shell", use "dumpsys power" to
> check your alarm after it's been set.

You probably meant "dumpsys alarm"?

-- 
Regards,
Marcin Orlowski

-- 
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: Status Bar Notifications

2011-03-11 Thread Kostya Vasilyev
"All possible values in UTC time" - there are (2 << 63) - 1 of those, 
which is almost 10 ^ 19, so I don't see how you could have tried them 
all so fast :)


Even without a wake lock, your receiver's onReceive should still be 
called (you do log that, right?).


RTC_WAKEUP uses wall clock time in the UTC time zone.

Make sure your code correctly computes the time value, I think that's 
where the bug is. Specifically, I think you're possibly getting the 
value in the wrong time zone (your own time zone, perhaps, and not UTC).


A few possible things to try:

- Log the value you feed to AlarmManager, log the value of 
System.currentTimeMillis(), see what they look like relative to one another.


- Repeat the above with the hour/minute value closer to "now", so it's 
easier to verify.


- Connect to your phone/emulator with "adb shell", use "dumpsys power" 
to check your alarm after it's been set.


Oh, and make sure your phone/emulator's date/time are set, including the 
time zone.


-- Kostya

11.03.2011 21:04, Brad Stintson пишет:
For calendar values, i tried all possible values in UTC time as well 
as emulator time. Still it is not showing the notification. Is it 
related to WakeLock?  If yes, then how to implement it?



--
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: Status Bar Notifications

2011-03-11 Thread Brad Stintson
For calendar values, i tried all possible values in UTC time as well as
emulator time. Still it is not showing the notification. Is it related to
WakeLock?  If yes, then how to implement it?

2011/3/11 Kostya Vasilyev 

>  Sounds like your Calendar-based time calculation is wrong (for the
> original, non-repeating case).
>
> -- Kostya
>
> 11.03.2011 20:31, Brad Stintson пишет:
>
> Moreover, if i set reminder to current time using
>
> alarms.setRepeating(AlarmManager.ELAPSED_REALTIME,
> SystemClock.elapsedRealtime(),
>30 * 1000, alarmIntent);
>
>  then it is notifying perfectly.
>
> 2011/3/11 Brad Stintson 
>
>>
>>
>> 2011/3/11 Kostya Vasilyev 
>>
>>  Before you look into using a WakeLock (which might not be necessary,
>>> since Android keeps a wake lock for the duration of your onReceive)...
>>>
>>> There are a few things in your code that look rather strange to me:
>>>
>>> 1 - Your broadcast receiver is called Notification (bad name, btw, as it
>>> clashes with an Android class), and yet when setting the alarm, you use
>>> TimeAlarm:
>>>
>>>
>>> Intent activate = new Intent(this, *TimeAlarm*.class);
>>>
>>
>>  I changed this to notification class
>>
>>>
>>>  2 - Inside onReceive, you call PendingIntent.getActivity() with the
>>> intent received by the broadcast receiver. Does that intent really point to
>>> an Activity?
>>>
>>
>>  I removed that
>>
>>>
>>> 3 - Not shown in your original email, but - did you declare your
>>> broadcast receiver in the manifest?
>>>
>>
>>  Ya I have declared that
>>
>>  But still it is not showing on specified time.
>>
>>>
>>> After dealing with the above, as next step, I'd add debug logging,
>>> shorten the alarm interval just for debugging (say, five minutes) and check
>>> what happens.
>>>
>>> -- Kostya
>>>
>>> 11.03.2011 19:22, Brad Stintson пишет:
>>>
>>>  How should I implement WakeLock in my above mentioned code?
>>>
>>>
>>> 2011/3/11 Jonathan Foley 
>>>

 Is the device going to sleep? If so you'll need to acquire a WakeLock
 otherwise it will wake up for the alarm and may fall back asleep
 before the notification ever gets fired.


 Jonathan

 On Mar 10, 10:06 pm, Brad Stintson  wrote:
 > *My application is not triggering notification at specified alarm
 time.
  > Please see below classes and tell me how to do that.*
 > *
 > *
 > *
 > *
 > *This is my notification class.*
 > public class Notificaition extends BroadcastReceiver {
 >
 > @Override
 > public void onReceive(Context context, Intent intent) {
 >
 >   NotificationManager nm = (NotificationManager) context
 > .getSystemService(Context.NOTIFICATION_SERVICE);
 >  CharSequence from = "App Name";
 >  CharSequence message = "Event Title";
 >  PendingIntent contentIntent = PendingIntent.getActivity(context,
 0,
 >intent, 0);
 >  Notification notif = new Notification(R.drawable.icon,
 >"EVENT", System.currentTimeMillis());
 >  long[] vibrate = {100,100,200,300};
 >  notif.vibrate = vibrate;
 >  notif.defaults =Notification.DEFAULT_ALL;
 > notif.setLatestEventInfo(context, from, message, contentIntent);
 >  nm.notify(1, notif);
 > }
 >
 > *And this is my alarm class*
 > public class AlarmTrig extends Activity {
 >  AlarmManager alarms;
 >
 > @Override
 > public void onCreate(Bundle savedInstanceState) {
 > super.onCreate(savedInstanceState);
 > setContentView(R.layout.main);
 > am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
 >
 > setOneTimeAlarm();
 >
 > }
 >
 > public void setOneTimeAlarm() {
 >   Calendar cal = Calendar.getInstance();
 >
 >   cal.setTimeInMillis(System.currentTimeMillis());
 >   cal.clear();
 >   cal.set(Calendar.YEAR, mYear);
 >   cal.set(Calendar.MONTH,mMonth);
 >   cal.set(Calendar.DAY_OF_MONTH,mDay);
 >   cal.set(Calendar.HOUR,mHour);
 >   cal.set(Calendar.MINUTE,mMinutes);
 >   cal.set(Calendar.SECOND, mSeconds);
 >
 >  // where mYear, mMonths, mDay, mHour and mMinutes are int values from
 the
 > Date and Time picker dialogs respectively
 >
 >   Intent activate = new Intent(this, TimeAlarm.class);
 >   PendingIntent alarmIntent = PendingIntent.getBroadcast(this, 0,
 > activate, 0);
 >alarms = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
 >   alarms.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
 > alarmIntent);
 > }
 >
 >
 >
 >
 >
 >
 >
  > On Thu, Mar 10, 2011 at 7:21 PM, Kostya Vasilyev 
 wrote:
 > > From a database? Same as anything else, by using a query. Probably
 easiest
 > > to

Re: [android-developers] Re: Status Bar Notifications

2011-03-11 Thread Brad Stintson
2011/3/11 Kostya Vasilyev 

>  Before you look into using a WakeLock (which might not be necessary, since
> Android keeps a wake lock for the duration of your onReceive)...
>
> There are a few things in your code that look rather strange to me:
>
> 1 - Your broadcast receiver is called Notification (bad name, btw, as it
> clashes with an Android class), and yet when setting the alarm, you use
> TimeAlarm:
>
>
> Intent activate = new Intent(this, *TimeAlarm*.class);
>

I changed this to notification class

>
> 2 - Inside onReceive, you call PendingIntent.getActivity() with the intent
> received by the broadcast receiver. Does that intent really point to an
> Activity?
>

I removed that

>
> 3 - Not shown in your original email, but - did you declare your broadcast
> receiver in the manifest?
>

Ya I have declared that

But still it is not showing on specified time.

>
> After dealing with the above, as next step, I'd add debug logging, shorten
> the alarm interval just for debugging (say, five minutes) and check what
> happens.
>
> -- Kostya
>
> 11.03.2011 19:22, Brad Stintson пишет:
>
> How should I implement WakeLock in my above mentioned code?
>
>
> 2011/3/11 Jonathan Foley 
>
>>
>> Is the device going to sleep? If so you'll need to acquire a WakeLock
>> otherwise it will wake up for the alarm and may fall back asleep
>> before the notification ever gets fired.
>>
>>
>> Jonathan
>>
>> On Mar 10, 10:06 pm, Brad Stintson  wrote:
>> > *My application is not triggering notification at specified alarm time.
>>  > Please see below classes and tell me how to do that.*
>> > *
>> > *
>> > *
>> > *
>> > *This is my notification class.*
>> > public class Notificaition extends BroadcastReceiver {
>> >
>> > @Override
>> > public void onReceive(Context context, Intent intent) {
>> >
>> >   NotificationManager nm = (NotificationManager) context
>> > .getSystemService(Context.NOTIFICATION_SERVICE);
>> >  CharSequence from = "App Name";
>> >  CharSequence message = "Event Title";
>> >  PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
>> >intent, 0);
>> >  Notification notif = new Notification(R.drawable.icon,
>> >"EVENT", System.currentTimeMillis());
>> >  long[] vibrate = {100,100,200,300};
>> >  notif.vibrate = vibrate;
>> >  notif.defaults =Notification.DEFAULT_ALL;
>> > notif.setLatestEventInfo(context, from, message, contentIntent);
>> >  nm.notify(1, notif);
>> > }
>> >
>> > *And this is my alarm class*
>> > public class AlarmTrig extends Activity {
>> >  AlarmManager alarms;
>> >
>> > @Override
>> > public void onCreate(Bundle savedInstanceState) {
>> > super.onCreate(savedInstanceState);
>> > setContentView(R.layout.main);
>> > am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
>> >
>> > setOneTimeAlarm();
>> >
>> > }
>> >
>> > public void setOneTimeAlarm() {
>> >   Calendar cal = Calendar.getInstance();
>> >
>> >   cal.setTimeInMillis(System.currentTimeMillis());
>> >   cal.clear();
>> >   cal.set(Calendar.YEAR, mYear);
>> >   cal.set(Calendar.MONTH,mMonth);
>> >   cal.set(Calendar.DAY_OF_MONTH,mDay);
>> >   cal.set(Calendar.HOUR,mHour);
>> >   cal.set(Calendar.MINUTE,mMinutes);
>> >   cal.set(Calendar.SECOND, mSeconds);
>> >
>> >  // where mYear, mMonths, mDay, mHour and mMinutes are int values from
>> the
>> > Date and Time picker dialogs respectively
>> >
>> >   Intent activate = new Intent(this, TimeAlarm.class);
>> >   PendingIntent alarmIntent = PendingIntent.getBroadcast(this, 0,
>> > activate, 0);
>> >alarms = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
>> >   alarms.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
>> > alarmIntent);
>> > }
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>>  > On Thu, Mar 10, 2011 at 7:21 PM, Kostya Vasilyev 
>> wrote:
>> > > From a database? Same as anything else, by using a query. Probably
>> easiest
>> > > to keep date/time values as a long integer (standard Unix
>> representation).
>> >
>> > > Once you have the time value, use AlarmManager and NotificationManager
>> > > classes in Android.
>>  > > 10.03.2011 16:47 пользователь "Brad Stintson" > >
>> > > написал:
>> >
>> > > > How to get time from database n trigger notification on that time?
>> >
>>  > > > On Thu, Mar 10, 2011 at 4:45 AM, roberto 
>>  > > wrote:
>> >
>> > > >> On Mar 9, 11:41 am, Marcin Orlowski 
>> wrote:
>> > > >> > On 9 March 2011 19:59, roberto  wrote:
>> >
>> > > >> > >http://hub.buzzbox.com/android-sdk/
>> >
>> > > >> > Looks interesting but I personally am not happy with it being
>> closed
>> > > >> > source (which I could stand) but integration with their analics.
>> Who
>> > > >> > knows what it analites when your app got internet permission. But
>> can
>> > > >> > be I am simply exaggerating :)
>> >
>> > > >> the buzzbox sdk actually does not re

Re: [android-developers] Re: Status Bar Notifications

2011-03-11 Thread Kostya Vasilyev
Sounds like your Calendar-based time calculation is wrong (for the 
original, non-repeating case).


-- Kostya

11.03.2011 20:31, Brad Stintson пишет:

Moreover, if i set reminder to current time using

   alarms.setRepeating(AlarmManager.ELAPSED_REALTIME, 
SystemClock.elapsedRealtime(),

   30 * 1000, alarmIntent);

then it is notifying perfectly.

2011/3/11 Brad Stintson >




2011/3/11 Kostya Vasilyev mailto:kmans...@gmail.com>>

Before you look into using a WakeLock (which might not be
necessary, since Android keeps a wake lock for the duration of
your onReceive)...

There are a few things in your code that look rather strange
to me:

1 - Your broadcast receiver is called Notification (bad name,
btw, as it clashes with an Android class), and yet when
setting the alarm, you use TimeAlarm:


Intent activate = new Intent(this, *TimeAlarm*.class);


I changed this to notification class


2 - Inside onReceive, you call PendingIntent.getActivity()
with the intent received by the broadcast receiver. Does that
intent really point to an Activity?


I removed that


3 - Not shown in your original email, but - did you declare
your broadcast receiver in the manifest?


Ya I have declared that

But still it is not showing on specified time.


After dealing with the above, as next step, I'd add debug
logging, shorten the alarm interval just for debugging (say,
five minutes) and check what happens.

-- Kostya

11.03.2011 19:22, Brad Stintson пишет:

How should I implement WakeLock in my above mentioned code?


2011/3/11 Jonathan Foley mailto:jonefo...@gmail.com>>


Is the device going to sleep? If so you'll need to
acquire a WakeLock
otherwise it will wake up for the alarm and may fall back
asleep
before the notification ever gets fired.


Jonathan

On Mar 10, 10:06 pm, Brad Stintson mailto:geek.bin...@gmail.com>> wrote:
> *My application is not triggering notification at
specified alarm time.
> Please see below classes and tell me how to do that.*
> *
> *
> *
> *
> *This is my notification class.*
> public class Notificaition extends BroadcastReceiver {
>
> @Override
> public void onReceive(Context context, Intent
intent) {
>
>   NotificationManager nm =
(NotificationManager) context
> .getSystemService(Context.NOTIFICATION_SERVICE);
>  CharSequence from = "App Name";
>  CharSequence message = "Event Title";
>  PendingIntent contentIntent =
PendingIntent.getActivity(context, 0,
>intent, 0);
>  Notification notif = new Notification(R.drawable.icon,
>"EVENT", System.currentTimeMillis());
>  long[] vibrate = {100,100,200,300};
>  notif.vibrate = vibrate;
>  notif.defaults =Notification.DEFAULT_ALL;
> notif.setLatestEventInfo(context, from, message,
contentIntent);
>  nm.notify(1, notif);
> }
>
> *And this is my alarm class*
> public class AlarmTrig extends Activity {
>  AlarmManager alarms;
>
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.main);
> am = (AlarmManager)
getSystemService(Context.ALARM_SERVICE);
>
> setOneTimeAlarm();
>
> }
>
> public void setOneTimeAlarm() {
>   Calendar cal = Calendar.getInstance();
>
>   cal.setTimeInMillis(System.currentTimeMillis());
>   cal.clear();
>   cal.set(Calendar.YEAR, mYear);
>   cal.set(Calendar.MONTH,mMonth);
>   cal.set(Calendar.DAY_OF_MONTH,mDay);
>   cal.set(Calendar.HOUR,mHour);
>   cal.set(Calendar.MINUTE,mMinutes);
>   cal.set(Calendar.SECOND, mSeconds);
>
>  // where mYear, mMonths, mDay, mHour and mMinutes are
int values from the
> Date and Time picker dialogs respectively
>
>   Intent activate = new Intent(this, TimeAlarm.class);
>   PendingIntent alarmIntent =
PendingIntent.getBroadcast(this, 0,
 

Re: [android-developers] Re: Status Bar Notifications

2011-03-11 Thread Brad Stintson
Moreover, if i set reminder to current time using

   alarms.setRepeating(AlarmManager.ELAPSED_REALTIME,
SystemClock.elapsedRealtime(),
   30 * 1000, alarmIntent);

then it is notifying perfectly.

2011/3/11 Brad Stintson 

>
>
> 2011/3/11 Kostya Vasilyev 
>
>  Before you look into using a WakeLock (which might not be necessary, since
>> Android keeps a wake lock for the duration of your onReceive)...
>>
>> There are a few things in your code that look rather strange to me:
>>
>> 1 - Your broadcast receiver is called Notification (bad name, btw, as it
>> clashes with an Android class), and yet when setting the alarm, you use
>> TimeAlarm:
>>
>>
>> Intent activate = new Intent(this, *TimeAlarm*.class);
>>
>
> I changed this to notification class
>
>>
>> 2 - Inside onReceive, you call PendingIntent.getActivity() with the intent
>> received by the broadcast receiver. Does that intent really point to an
>> Activity?
>>
>
> I removed that
>
>>
>> 3 - Not shown in your original email, but - did you declare your broadcast
>> receiver in the manifest?
>>
>
> Ya I have declared that
>
> But still it is not showing on specified time.
>
>>
>> After dealing with the above, as next step, I'd add debug logging, shorten
>> the alarm interval just for debugging (say, five minutes) and check what
>> happens.
>>
>> -- Kostya
>>
>> 11.03.2011 19:22, Brad Stintson пишет:
>>
>> How should I implement WakeLock in my above mentioned code?
>>
>>
>> 2011/3/11 Jonathan Foley 
>>
>>>
>>> Is the device going to sleep? If so you'll need to acquire a WakeLock
>>> otherwise it will wake up for the alarm and may fall back asleep
>>> before the notification ever gets fired.
>>>
>>>
>>> Jonathan
>>>
>>> On Mar 10, 10:06 pm, Brad Stintson  wrote:
>>> > *My application is not triggering notification at specified alarm time.
>>>  > Please see below classes and tell me how to do that.*
>>> > *
>>> > *
>>> > *
>>> > *
>>> > *This is my notification class.*
>>> > public class Notificaition extends BroadcastReceiver {
>>> >
>>> > @Override
>>> > public void onReceive(Context context, Intent intent) {
>>> >
>>> >   NotificationManager nm = (NotificationManager) context
>>> > .getSystemService(Context.NOTIFICATION_SERVICE);
>>> >  CharSequence from = "App Name";
>>> >  CharSequence message = "Event Title";
>>> >  PendingIntent contentIntent = PendingIntent.getActivity(context,
>>> 0,
>>> >intent, 0);
>>> >  Notification notif = new Notification(R.drawable.icon,
>>> >"EVENT", System.currentTimeMillis());
>>> >  long[] vibrate = {100,100,200,300};
>>> >  notif.vibrate = vibrate;
>>> >  notif.defaults =Notification.DEFAULT_ALL;
>>> > notif.setLatestEventInfo(context, from, message, contentIntent);
>>> >  nm.notify(1, notif);
>>> > }
>>> >
>>> > *And this is my alarm class*
>>> > public class AlarmTrig extends Activity {
>>> >  AlarmManager alarms;
>>> >
>>> > @Override
>>> > public void onCreate(Bundle savedInstanceState) {
>>> > super.onCreate(savedInstanceState);
>>> > setContentView(R.layout.main);
>>> > am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
>>> >
>>> > setOneTimeAlarm();
>>> >
>>> > }
>>> >
>>> > public void setOneTimeAlarm() {
>>> >   Calendar cal = Calendar.getInstance();
>>> >
>>> >   cal.setTimeInMillis(System.currentTimeMillis());
>>> >   cal.clear();
>>> >   cal.set(Calendar.YEAR, mYear);
>>> >   cal.set(Calendar.MONTH,mMonth);
>>> >   cal.set(Calendar.DAY_OF_MONTH,mDay);
>>> >   cal.set(Calendar.HOUR,mHour);
>>> >   cal.set(Calendar.MINUTE,mMinutes);
>>> >   cal.set(Calendar.SECOND, mSeconds);
>>> >
>>> >  // where mYear, mMonths, mDay, mHour and mMinutes are int values from
>>> the
>>> > Date and Time picker dialogs respectively
>>> >
>>> >   Intent activate = new Intent(this, TimeAlarm.class);
>>> >   PendingIntent alarmIntent = PendingIntent.getBroadcast(this, 0,
>>> > activate, 0);
>>> >alarms = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
>>> >   alarms.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
>>> > alarmIntent);
>>> > }
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>>  > On Thu, Mar 10, 2011 at 7:21 PM, Kostya Vasilyev 
>>> wrote:
>>> > > From a database? Same as anything else, by using a query. Probably
>>> easiest
>>> > > to keep date/time values as a long integer (standard Unix
>>> representation).
>>> >
>>> > > Once you have the time value, use AlarmManager and
>>> NotificationManager
>>> > > classes in Android.
>>>  > > 10.03.2011 16:47 пользователь "Brad Stintson" <
>>> geek.bin...@gmail.com>
>>> > > написал:
>>> >
>>> > > > How to get time from database n trigger notification on that time?
>>> >
>>>  > > > On Thu, Mar 10, 2011 at 4:45 AM, roberto >> >
>>>  > > wrote:
>>> >
>>> > > >> On Mar 9, 11:41 am, Marcin Orlowski 
>>> wrote:
>>> > > >> > On 9 March 2

Re: [android-developers] Re: Status Bar Notifications

2011-03-11 Thread Kostya Vasilyev
Before you look into using a WakeLock (which might not be necessary, 
since Android keeps a wake lock for the duration of your onReceive)...


There are a few things in your code that look rather strange to me:

1 - Your broadcast receiver is called Notification (bad name, btw, as it 
clashes with an Android class), and yet when setting the alarm, you use 
TimeAlarm:


Intent activate = new Intent(this, *TimeAlarm*.class);

2 - Inside onReceive, you call PendingIntent.getActivity() with the 
intent received by the broadcast receiver. Does that intent really point 
to an Activity?


3 - Not shown in your original email, but - did you declare your 
broadcast receiver in the manifest?


After dealing with the above, as next step, I'd add debug logging, 
shorten the alarm interval just for debugging (say, five minutes) and 
check what happens.


-- Kostya

11.03.2011 19:22, Brad Stintson пишет:

How should I implement WakeLock in my above mentioned code?


2011/3/11 Jonathan Foley >



Is the device going to sleep? If so you'll need to acquire a WakeLock
otherwise it will wake up for the alarm and may fall back asleep
before the notification ever gets fired.


Jonathan

On Mar 10, 10:06 pm, Brad Stintson mailto:geek.bin...@gmail.com>> wrote:
> *My application is not triggering notification at specified
alarm time.
> Please see below classes and tell me how to do that.*
> *
> *
> *
> *
> *This is my notification class.*
> public class Notificaition extends BroadcastReceiver {
>
> @Override
> public void onReceive(Context context, Intent intent) {
>
>   NotificationManager nm = (NotificationManager) context
> .getSystemService(Context.NOTIFICATION_SERVICE);
>  CharSequence from = "App Name";
>  CharSequence message = "Event Title";
>  PendingIntent contentIntent =
PendingIntent.getActivity(context, 0,
>intent, 0);
>  Notification notif = new Notification(R.drawable.icon,
>"EVENT", System.currentTimeMillis());
>  long[] vibrate = {100,100,200,300};
>  notif.vibrate = vibrate;
>  notif.defaults =Notification.DEFAULT_ALL;
> notif.setLatestEventInfo(context, from, message, contentIntent);
>  nm.notify(1, notif);
> }
>
> *And this is my alarm class*
> public class AlarmTrig extends Activity {
>  AlarmManager alarms;
>
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.main);
> am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
>
> setOneTimeAlarm();
>
> }
>
> public void setOneTimeAlarm() {
>   Calendar cal = Calendar.getInstance();
>
>   cal.setTimeInMillis(System.currentTimeMillis());
>   cal.clear();
>   cal.set(Calendar.YEAR, mYear);
>   cal.set(Calendar.MONTH,mMonth);
>   cal.set(Calendar.DAY_OF_MONTH,mDay);
>   cal.set(Calendar.HOUR,mHour);
>   cal.set(Calendar.MINUTE,mMinutes);
>   cal.set(Calendar.SECOND, mSeconds);
>
>  // where mYear, mMonths, mDay, mHour and mMinutes are int
values from the
> Date and Time picker dialogs respectively
>
>   Intent activate = new Intent(this, TimeAlarm.class);
>   PendingIntent alarmIntent =
PendingIntent.getBroadcast(this, 0,
> activate, 0);
>alarms =
(AlarmManager)getSystemService(Context.ALARM_SERVICE);
>   alarms.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
> alarmIntent);
> }
>
>
>
>
>
>
>
> On Thu, Mar 10, 2011 at 7:21 PM, Kostya Vasilyev
mailto:kmans...@gmail.com>> wrote:
> > From a database? Same as anything else, by using a query.
Probably easiest
> > to keep date/time values as a long integer (standard Unix
representation).
>
> > Once you have the time value, use AlarmManager and
NotificationManager
> > classes in Android.
> > 10.03.2011 16:47 пользователь "Brad Stintson"
mailto:geek.bin...@gmail.com>>
> > написал:
>
> > > How to get time from database n trigger notification on that
time?
>
> > > On Thu, Mar 10, 2011 at 4:45 AM, roberto
mailto:roberto.fo...@gmail.com>>
> > wrote:
>
> > >> On Mar 9, 11:41 am, Marcin Orlowski
mailto:webnet.andr...@gmail.com>> wrote:
> > >> > On 9 March 2011 19:59, roberto mailto:roberto.fo...@gmail.com>> wrote:
>
> > >> > >http://hub.buzzbox.com/android-sdk/
>
> > >> > Looks interesting but I personally am not happy with it
being closed
> > >> > source (which I could stand) but integration with their
analics. Who
> > >> > knows what it analites when your app 

Re: [android-developers] Re: Status Bar Notifications

2011-03-11 Thread Brad Stintson
How should I implement WakeLock in my above mentioned code?


2011/3/11 Jonathan Foley 

>
> Is the device going to sleep? If so you'll need to acquire a WakeLock
> otherwise it will wake up for the alarm and may fall back asleep
> before the notification ever gets fired.
>
>
> Jonathan
>
> On Mar 10, 10:06 pm, Brad Stintson  wrote:
> > *My application is not triggering notification at specified alarm time.
> > Please see below classes and tell me how to do that.*
> > *
> > *
> > *
> > *
> > *This is my notification class.*
> > public class Notificaition extends BroadcastReceiver {
> >
> > @Override
> > public void onReceive(Context context, Intent intent) {
> >
> >   NotificationManager nm = (NotificationManager) context
> > .getSystemService(Context.NOTIFICATION_SERVICE);
> >  CharSequence from = "App Name";
> >  CharSequence message = "Event Title";
> >  PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
> >intent, 0);
> >  Notification notif = new Notification(R.drawable.icon,
> >"EVENT", System.currentTimeMillis());
> >  long[] vibrate = {100,100,200,300};
> >  notif.vibrate = vibrate;
> >  notif.defaults =Notification.DEFAULT_ALL;
> > notif.setLatestEventInfo(context, from, message, contentIntent);
> >  nm.notify(1, notif);
> > }
> >
> > *And this is my alarm class*
> > public class AlarmTrig extends Activity {
> >  AlarmManager alarms;
> >
> > @Override
> > public void onCreate(Bundle savedInstanceState) {
> > super.onCreate(savedInstanceState);
> > setContentView(R.layout.main);
> > am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
> >
> > setOneTimeAlarm();
> >
> > }
> >
> > public void setOneTimeAlarm() {
> >   Calendar cal = Calendar.getInstance();
> >
> >   cal.setTimeInMillis(System.currentTimeMillis());
> >   cal.clear();
> >   cal.set(Calendar.YEAR, mYear);
> >   cal.set(Calendar.MONTH,mMonth);
> >   cal.set(Calendar.DAY_OF_MONTH,mDay);
> >   cal.set(Calendar.HOUR,mHour);
> >   cal.set(Calendar.MINUTE,mMinutes);
> >   cal.set(Calendar.SECOND, mSeconds);
> >
> >  // where mYear, mMonths, mDay, mHour and mMinutes are int values from
> the
> > Date and Time picker dialogs respectively
> >
> >   Intent activate = new Intent(this, TimeAlarm.class);
> >   PendingIntent alarmIntent = PendingIntent.getBroadcast(this, 0,
> > activate, 0);
> >alarms = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
> >   alarms.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
> > alarmIntent);
> > }
> >
> >
> >
> >
> >
> >
> >
> > On Thu, Mar 10, 2011 at 7:21 PM, Kostya Vasilyev 
> wrote:
> > > From a database? Same as anything else, by using a query. Probably
> easiest
> > > to keep date/time values as a long integer (standard Unix
> representation).
> >
> > > Once you have the time value, use AlarmManager and NotificationManager
> > > classes in Android.
> > > 10.03.2011 16:47 пользователь "Brad Stintson" 
> > > написал:
> >
> > > > How to get time from database n trigger notification on that time?
> >
> > > > On Thu, Mar 10, 2011 at 4:45 AM, roberto 
> > > wrote:
> >
> > > >> On Mar 9, 11:41 am, Marcin Orlowski 
> wrote:
> > > >> > On 9 March 2011 19:59, roberto  wrote:
> >
> > > >> > >http://hub.buzzbox.com/android-sdk/
> >
> > > >> > Looks interesting but I personally am not happy with it being
> closed
> > > >> > source (which I could stand) but integration with their analics.
> Who
> > > >> > knows what it analites when your app got internet permission. But
> can
> > > >> > be I am simply exaggerating :)
> >
> > > >> the buzzbox sdk actually does not require internet permission if you
> > > >> don't want to use the analytics.
> > > >> you can use the scheduler without analytics.
> >
> > > >> Roberto
> >
> > > >> > --
> > > >> > Regards,
> > > >> > Marcin Orlowski
> >
> > > >> --
> > > >> 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
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > >

Re: [android-developers] Re: Status Bar Notifications

2011-03-10 Thread Brad Stintson
*My application is not triggering notification at specified alarm time.
Please see below classes and tell me how to do that.*
*
*
*
*
*This is my notification class.*
public class Notificaition extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {

  NotificationManager nm = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
 CharSequence from = "App Name";
 CharSequence message = "Event Title";
 PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
   intent, 0);
 Notification notif = new Notification(R.drawable.icon,
   "EVENT", System.currentTimeMillis());
 long[] vibrate = {100,100,200,300};
 notif.vibrate = vibrate;
 notif.defaults =Notification.DEFAULT_ALL;
notif.setLatestEventInfo(context, from, message, contentIntent);
 nm.notify(1, notif);
}

*And this is my alarm class*
public class AlarmTrig extends Activity {
 AlarmManager alarms;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);


setOneTimeAlarm();

}

public void setOneTimeAlarm() {
  Calendar cal = Calendar.getInstance();

  cal.setTimeInMillis(System.currentTimeMillis());
  cal.clear();
  cal.set(Calendar.YEAR, mYear);
  cal.set(Calendar.MONTH,mMonth);
  cal.set(Calendar.DAY_OF_MONTH,mDay);
  cal.set(Calendar.HOUR,mHour);
  cal.set(Calendar.MINUTE,mMinutes);
  cal.set(Calendar.SECOND, mSeconds);

 // where mYear, mMonths, mDay, mHour and mMinutes are int values from the
Date and Time picker dialogs respectively

  Intent activate = new Intent(this, TimeAlarm.class);
  PendingIntent alarmIntent = PendingIntent.getBroadcast(this, 0,
activate, 0);
   alarms = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
  alarms.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
alarmIntent);
}




On Thu, Mar 10, 2011 at 7:21 PM, Kostya Vasilyev  wrote:

> From a database? Same as anything else, by using a query. Probably easiest
> to keep date/time values as a long integer (standard Unix representation).
>
> Once you have the time value, use AlarmManager and NotificationManager
> classes in Android.
> 10.03.2011 16:47 пользователь "Brad Stintson" 
> написал:
>
> > How to get time from database n trigger notification on that time?
> >
> > On Thu, Mar 10, 2011 at 4:45 AM, roberto 
> wrote:
> >
> >>
> >>
> >> On Mar 9, 11:41 am, Marcin Orlowski  wrote:
> >> > On 9 March 2011 19:59, roberto  wrote:
> >> >
> >> > >http://hub.buzzbox.com/android-sdk/
> >> >
> >> > Looks interesting but I personally am not happy with it being closed
> >> > source (which I could stand) but integration with their analics. Who
> >> > knows what it analites when your app got internet permission. But can
> >> > be I am simply exaggerating :)
> >>
> >> the buzzbox sdk actually does not require internet permission if you
> >> don't want to use the analytics.
> >> you can use the scheduler without analytics.
> >>
> >> Roberto
> >>
> >> >
> >> > --
> >> > Regards,
> >> > Marcin Orlowski
> >>
> >> --
> >> 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
>
> --
> 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: Status Bar Notifications

2011-03-10 Thread Kostya Vasilyev
>From a database? Same as anything else, by using a query. Probably easiest
to keep date/time values as a long integer (standard Unix representation).

Once you have the time value, use AlarmManager and NotificationManager
classes in Android.
10.03.2011 16:47 пользователь "Brad Stintson" 
написал:
> How to get time from database n trigger notification on that time?
>
> On Thu, Mar 10, 2011 at 4:45 AM, roberto  wrote:
>
>>
>>
>> On Mar 9, 11:41 am, Marcin Orlowski  wrote:
>> > On 9 March 2011 19:59, roberto  wrote:
>> >
>> > >http://hub.buzzbox.com/android-sdk/
>> >
>> > Looks interesting but I personally am not happy with it being closed
>> > source (which I could stand) but integration with their analics. Who
>> > knows what it analites when your app got internet permission. But can
>> > be I am simply exaggerating :)
>>
>> the buzzbox sdk actually does not require internet permission if you
>> don't want to use the analytics.
>> you can use the scheduler without analytics.
>>
>> Roberto
>>
>> >
>> > --
>> > Regards,
>> > Marcin Orlowski
>>
>> --
>> 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

-- 
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: Status Bar Notifications

2011-03-10 Thread Brad Stintson
How to get time from database n trigger notification on that time?

On Thu, Mar 10, 2011 at 4:45 AM, roberto  wrote:

>
>
> On Mar 9, 11:41 am, Marcin Orlowski  wrote:
> > On 9 March 2011 19:59, roberto  wrote:
> >
> > >http://hub.buzzbox.com/android-sdk/
> >
> > Looks interesting but I personally am not happy with it being closed
> > source (which I could stand) but integration with their analics. Who
> > knows what it analites when your app got internet permission. But can
> > be I am simply exaggerating :)
>
> the buzzbox sdk actually does not require internet permission if you
> don't want to use the analytics.
> you can use the scheduler without analytics.
>
> Roberto
>
> >
> > --
> > Regards,
> > Marcin Orlowski
>
> --
> 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: Status Bar Notifications

2011-03-09 Thread Marcin Orlowski
On 9 March 2011 19:59, roberto  wrote:

> http://hub.buzzbox.com/android-sdk/

Looks interesting but I personally am not happy with it being closed
source (which I could stand) but integration with their analics. Who
knows what it analites when your app got internet permission. But can
be I am simply exaggerating :)

-- 
Regards,
Marcin Orlowski

-- 
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