0

I am a new developer and don't know much about android programming. I am trying to make an app that reminds a user to do a particular thing every day at a specific time (like going to gym at 5:30 pm). I am able to get a notification after clicking of a button but i want this to be done by the app i.e. even if the app is not running it will remind me everyday to go the gym at 5:30. How can I get this???

I tried using AlarmManager but it gives my notification at that time only and sets the alarm for the specified time.

tshepang
  • 12,111
  • 21
  • 91
  • 136
bhakti123
  • 833
  • 10
  • 22

1 Answers1

0

Set repeating alarm. on broadcast receiver start your notification

yuva ツ
  • 3,707
  • 9
  • 50
  • 78
  • I tried to use broadcast receiver but it is showing one error. I am not getting what to do.`public void onReceive(Context context, Intent intent) {nm=(NotificationManager)getSystemService(NOTIFICATION_SERVICE); String body="i hope this works"; String title="trying"; Intent it=new Intent(context,SecondActivity.class); PendingIntent pit=PendingIntent.getActivity(context, 0, it,0); Notification n=new Notification(R.drawable.att,body,System.currentTimeMillis()); n.setLatestEventInfo(context, title, body, pit); n.defaults=Notification.DEFAULT_ALL; nm.notify(uniqueId, n); }` – bhakti123 Feb 20 '14 at 11:05
  • it is showing error in `nm=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);` – bhakti123 Feb 20 '14 at 11:08
  • use (NotificationManager)context.getSystemService(NOTIFICATION_SERVICE); – yuva ツ Feb 20 '14 at 11:54