String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
int icon = R.drawable.ic_launcher;
CharSequence tickerText = "Test";
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when);
Context context = getApplicationContext();
CharSequence contentTitle = "Test";
CharSequence contentText = "testing texts";
Intent notificationIntent = new Intent(this, HolotestActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
final int HELLO_ID = 1;
mNotificationManager.notify(HELLO_ID, notification);
I used for notification. How can I set for daily morning 9AM notification?. I am beginner. 😀
For that you need to create and run service class which will run all the time, then inside service class get the current time with certain intervals once time matched with your time add the notification bar. Refer below link for services :
Services