![]() Public override StartCommandResult OnStartCommand( intent, StartCommandFlags flags, int startId) Toast.MakeText(this, "service started ", ToastLength.Long).Show() Public class AppStickyService : IntentService Toast.MakeText(context, "DOSAGE MISSED", ToastLength.Short).Show() Toast.MakeText(context, "DOSAGE SKIPPED", ToastLength.Short).Show() ![]() Toast.MakeText(context, "DOSAGE TAKEN", ToastLength.Short).Show() MedicationDatabase db = new MedicationDatabase() Public override void OnReceive(Context context, Intent intent) Public class CustomActionReceiver : BroadcastReceiver cal = Ĭal.TimeInMillis = () Ĭal.Set(, hour) Ĭal.Set(, minute) Ĭal.Set(, 0) ĪlarmManager alarmManager = .GetSystemService() as AlarmManager ĪlarmManager.Set(AlarmType.RtcWakeup, cal.TimeInMillis, pendingintent) PendingIntent pendingintent = PendingIntent.GetBroadcast(, i, myintent, PendingIntentFlags.OneShot) Long millis = (long)ts.TotalMilliseconds TimeSpan ts = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)) Intent myintent = new Intent(, typeof(AlarmReceiver)) Public void SetAlarm(int hour, int minute, string title, string message) Public class SetAlarmImplementation : ISetAlarm How will i be able to register all the stored time in the alarm manager ?Īlarm Implementation: namespace Diabetes.Droid ("Error " + e) īut surprisingly if i insert directly time in the code like this it works fine : alarmService.SetAlarm(13, 14, "Diabetics App", "Hello " + username + ", I remind you to take your insulin at this stated time") ("Hour : " + hour + " Minutes : " + minute) ĪlarmService.SetAlarm(hour, minute, "Diabetics App", "Hello " + username + ", I remind you to take your insulin at this stated time") Minute = Int32.Parse(list.Substring(3, 2)) Hour = Int32.Parse(list.Substring(0, 2)) MedicationDatabase c = new MedicationDatabase() My codes are below: public void MyLooper()ĪlarmService = new SetAlarmImplementation() Then i used for each loop to make sure i insert the list of time in the scheduled manager, but the notification doesn't come.Įven when i tried to print in the console, it shows that the time isĪvailable, but am wondering why the notification not working. Am trying to schedule a notification with a list of time suppose i want to schedule the following time: 1.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |