Android Question create alarm with intent

ilan

Expert
Licensed User
Longtime User
hi

i have seen this thread to create an alarm via intent https://www.b4x.com/android/forum/threads/alarm.103098/

but how do i set the date for the alarm? can i also set it to repeat from Monday to Friday?

so what i need is to set an alarm at 7:00 that will repeat from monday to friday via intent.

thanks, ilan
 

ilan

Expert
Licensed User
Longtime User
ok i found already the answer:

B4X:
    SetAlarm(18,17,Array As Int(2,3,4,5,6))

B4X:
Sub SetAlarm(Hour As Int, Minutes As Int, days As List)
    Dim i As Intent
    i.Initialize("android.intent.action.SET_ALARM", "")
    i.PutExtra("android.intent.extra.alarm.HOUR", Hour)
    i.PutExtra("android.intent.extra.alarm.MINUTES", Minutes)
    i.PutExtra("android.intent.extra.alarm.DAYS", days)
    i.PutExtra("android.intent.extra.alarm.SKIP_UI", True)
    StartActivity(i)
    Log("alarm set")
End Sub

https://developer.android.com/reference/android/provider/AlarmClock
 
Upvote 0
Top