Android Question create alarm with intent

Discussion in 'Android Questions' started by ilan, Jul 17, 2019.

  1. ilan

    ilan Expert Licensed 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
     
  2. ilan

    ilan Expert Licensed User

    ok i found already the answer:

    Code:
    SetAlarm(18,17,Array As Int(2,3,4,5,6))
    Code:
    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
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice