Greetings,
I would like to programatically set in the stock Android alarm app the days of the week an alarm will be set. I found a reference to EXTRA_DAYS from this link: https://developer.android.com/reference/android/provider/AlarmClock#EXTRA_DAYS
Unfortunately, that web site is for people who know Java which I don't know. Anyway, I tried to create an array and guess what needed to be loaded in the array to pass to EXTRA_DAYS so I could set an alarm to go off on Monday, Wednesday and Friday just to see if I got the coding right. I got no errors, but the stock Android alarm app displayed a toast message that the alarm was set to go off today at the time set in my coding. The days of the week for that particular alarm were not set (they were dimmed out). This tells me my guess at coding the days of the week is wrong.
Can you tell me what I need to pass to EXTRA_DAYS so the correct days will be set? All I know so far is that it does need Int numbers in the array.
This is also the first time trying out arrays.
Here's the coding.
Thanks.
I would like to programatically set in the stock Android alarm app the days of the week an alarm will be set. I found a reference to EXTRA_DAYS from this link: https://developer.android.com/reference/android/provider/AlarmClock#EXTRA_DAYS
Unfortunately, that web site is for people who know Java which I don't know. Anyway, I tried to create an array and guess what needed to be loaded in the array to pass to EXTRA_DAYS so I could set an alarm to go off on Monday, Wednesday and Friday just to see if I got the coding right. I got no errors, but the stock Android alarm app displayed a toast message that the alarm was set to go off today at the time set in my coding. The days of the week for that particular alarm were not set (they were dimmed out). This tells me my guess at coding the days of the week is wrong.
Can you tell me what I need to pass to EXTRA_DAYS so the correct days will be set? All I know so far is that it does need Int numbers in the array.
This is also the first time trying out arrays.
Here's the coding.
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private i As Intent
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Main")
Dim arDays() As Int = Array As Int(1, 3, 5)
i.Initialize("android.intent.action.SET_ALARM", "")
i.PutExtra("android.intent.extra.alarm.HOUR", 20)
i.PutExtra("android.intent.extra.alarm.MINUTES", 30)
i.PutExtra("android.intent.extra.alarm.MESSAGE","My Alarm")
i.PutExtra("android.intent.extra.alarm.SKIP_UI", True)
i.PutExtra("android.intent.extra.alarm.DAYS", arDays)
StartActivity(i)
End Sub
Thanks.