Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make notification on android schedule by date, month, hour and minute?
    primarykey
    data
    text
    <p>I have an application with notification, I want to schedule once every year.. Below my code:</p> <pre><code>private void checkAlarm() { Calendar c = Calendar.getInstance(); int date = c.get(Calendar.DATE); int month = c.get(Calendar.MONTH); int year = c.get(Calendar.YEAR); int hour = c.get(Calendar.HOUR_OF_DAY); int minute = c.get(Calendar.MINUTE); if (date==17 &amp;&amp; month==8 &amp;&amp; hour==6 &amp;&amp; minute==0){ showNotification(R.drawable.sphere_notification, "hari ini 17 Agustus"); } } private void showNotification(int icon, String text) { Notification notification = new Notification(icon, "Hari ini memperingati Hari Kemerdekaan RI", System.currentTimeMillis()); notification.flags = Notification.FLAG_AUTO_CANCEL; notification.sound = Uri.parse("android.resource://app.vmh.main/"+R.raw.agustus); PendingIntent facebook = PendingIntent.getActivity(this, 0, new Intent(this, ShareOnFacebook.class),0); PendingIntent twitter = PendingIntent.getActivity(this, 0, new Intent(this, ShareOnTwitter.class),0); Intent exit = new Intent (Intent.ACTION_MAIN); exit.addCategory(Intent.CATEGORY_HOME); PendingIntent mainIntent = PendingIntent.getActivity(this, 0, exit,0); if (Pengaturan.getSetFacebook(this)){ notification.setLatestEventInfo(this, "Kemerdekaan - Remainder", text, facebook); }else if((Pengaturan.getSetFacebook(this)) &amp;&amp; (Pengaturan.getSetTwitter(this))){ notification.setLatestEventInfo(this, "Kemerdekaan - Remainder", text, facebook); }else if(Pengaturan.getSetTwitter(this)){ notification.setLatestEventInfo(this, "Kemerdekaan - Remainder", text, twitter); }else notification.setLatestEventInfo(this, "Kemerdekaan - Remainder", text, mainIntent); // Send the notification. mNM.notify(1, notification); } </code></pre> <p>I have problem when I implement date and month, notification not working. If I use hour and minute my app is working. Can u help me?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload