Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void setRepeatingAlarm(){
- Intent intent = new Intent(this, TimeAlarm.class);
- PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0,intent, PendingIntent.FLAG_UPDATE_CURRENT);
- am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), (5 * 1000), pendingIntent);
- }
- public void onReceive(Context context, Intent intent) {
- nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
- CharSequence from = "Homework";
- CharSequence message = "test"+ MainActivity.arraytest[x2]+ x2;
- x2 +=1;
- PendingIntent contentIntent = PendingIntent.getActivity(context, 0,new Intent(context,TimeAlarm.class), 0);
- Notification notif = new Notification(R.drawable.ic_launcher,"Update", System.currentTimeMillis());
- notif.setLatestEventInfo(context, from, message, contentIntent);
- nm.notify(notify_id, notif);
- }
Add Comment
Please, Sign In to add comment