*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 <[email protected]> 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" <[email protected]>
> написал:
>
> > How to get time from database n trigger notification on that time?
> >
> > On Thu, Mar 10, 2011 at 4:45 AM, roberto <[email protected]>
> wrote:
> >
> >>
> >>
> >> On Mar 9, 11:41 am, Marcin Orlowski <[email protected]> wrote:
> >> > On 9 March 2011 19:59, roberto <[email protected]> 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
> [email protected]
> >> To unsubscribe from this group, send email to
> >> [email protected]
> >> 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 [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to