Header Ads

[Android ] Set notification to specific time

http://blog.blundell-apps.com/notification-for-a-user-chosen-time/
http://stackoverflow.com/questions/14241439/set-notification-at-specific-time-android
android set time to notification

I would like my notification to run at 12:00pm everyday.

Intent myIntent = new Intent(ThisApp.this , myService.class);     
       AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
       pendingIntent = PendingIntent.getService(ThisApp.this, 0, myIntent, 0);

       Calendar calendar = Calendar.getInstance();
           calendar.set(Calendar.HOUR_OF_DAY, 12);
       calendar.set(Calendar.MINUTE, 00);
       calendar.set(Calendar.SECOND, 00);


      alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 24*60*60*1000 , pendingIntent);  //set repeating every 24 hours

No comments:

Powered by Blogger.