I have a widget and want it to open the default clock app when pressed. How can I make this work on all devices? I read something about android.provider.AlarmClock here: AlarmClock | Android Developers but I don't know if this helps in b4a.
Sub SetAlarm(Hour As Int, Minutes As Int)
Dim i As Intent
You will also need to add this line to the manifest editor:
Thanks for the help with setting the alarm. Everything is going well except two things, forgive me if these are basic questions as I'm new to this
1) Phone.GetSettings("next_alarm_formatted") takes the next set alarm in the android default clock app. Is there any way of changing it to pick up the time from another app, say Timely?
2) With regards to cancelling alarms I don't quite understand what you meant by "Try to call the intent in the second post without the time parameters." I have tried to pass the intent without adding android.intent.extra.alarm.HOUR etc and it does not seem to cancel an upcoming alarm but bring up the clock app with the alarm picker. Am I doing something wrong here?
How can I pass "android.intent.extra.alarm.DAYS" to this intent? I've tried the following code with no luck.
Dim days As List
Dim i As Intent
there is cancel method that could be used if the pending intent is known cancel(PendingIntent operation)
But i don't know how to call it from B4A
Sub cancel_alarm() '<-------------- pass the intent ?
Dim r As Reflector
r.Target = r.GetContext
r.Target = r.RunMethod2("getSystemService", "alarm", "java.lang.String")
r.RunMethod("cancel") '<------------- pass the intent ?
Log("cancel (PendingIntent operation)") '<--------------