मुझे एहसास है कि इस सवाल से पहले पूछा गया है, लेकिन मैं इस के साथ अपने बुद्धि के अंत में हूं।विशिष्ट समय पर अधिसूचना सेट करें
मैं एक अधिसूचना स्थापित करने के लिए एक अलार्म प्रबंधक है:
public void to_reminder(View view)
{
Intent intent=new Intent(this,Notification_morning.class);
AlarmManager manager=(AlarmManager)getSystemService(Activity.ALARM_SERVICE);
PendingIntent pendingIntent=PendingIntent.getService(this,
0,intent, 0);
Calendar cal=Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, timepicker.getCurrentHour());
cal.set(Calendar.MINUTE,timepicker.getCurrentMinute());
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
manager.setRepeating(AlarmManager.RTC_WAKEUP,cal.getTimeInMillis(),24*60*60*1000,pendingIntent);
}
... और फिर मैं सूचना से ही है कि एक सेवा है:
public class Notification_morning extends Service {
@Override
public void onCreate()
{
Toast.makeText(this, "MyAlarmService.onCreate()", Toast.LENGTH_LONG).show();
Intent resultIntent=new Intent(this, Calendar_start.class);
PendingIntent pIntent=PendingIntent.getActivity(this,0,resultIntent,0);
Notification noti_builder= new Notification.Builder(this)
.setContentTitle("Don't forget to plan your activitites for the day! ")
.setContentIntent(pIntent)
.build();
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); //what does this do!?
noti_builder.flags |=Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(1,noti_builder);
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
}
। ... मैंने यह सुनिश्चित करने के लिए टोस्ट को शामिल किया कि मैं वास्तव में इस विधि पर जा रहा था। टोस्ट आता है, लेकिन अधिसूचना नहीं है। मुझसे यहां क्या गलत हो रहा है? क्या यह मैनिफेस्ट फ़ाइल में कुछ है जिसे मुझे बदलने की ज़रूरत है?
वाह। हाँ यह आइकन था। कम से कम मैंने सभी दस्तावेजों पर जाकर कई अन्य सामानों के बारे में सीखा :)। प्रतीक्षा समय खत्म हो जाने पर ही इस उत्तर को स्वीकार करेंगे। – sam