"ACTION_SET_TIMER
Added in API level 19
public static final String ACTION_SET_TIMER
Activity Action: Set a timer.
Activates an existing timer or creates a new one.
This action requests a timer to be started for a specific length of time. If no length is specified, the implementation should start an activity that is capable of setting a timer (EXTRA_SKIP_UI is ignored in this case). If a length is specified, and EXTRA_SKIP_UI is true, the implementation should remove this timer after it has been dismissed. If an identical, unused timer exists matching both parameters, an implementation may re-use it instead of creating a new one (in this case, the timer should not be removed after dismissal). This action always starts the timer.
Request parameters
EXTRA_LENGTH (optional): The length of the timer being set.
EXTRA_MESSAGE (optional): A custom message for the timer.
EXTRA_SKIP_UI (optional): Whether or not to display an activity for setting this timer.
Constant Value: "android.intent.action.SET_TIMER"
"
i used the activitystarter.action with "android.intent.action.SET_TIMER"
now i dont know how to use activitystarter.EXTRAS to set the seconds..i dont understand the syntax.
i post the block image..can anyone fill the correct arguments in the text?
** ACTION_SET_ALARM does not provide a possibility to set the seconds
** ACTION_SET_TIMER it does..why not??
"ACTION_SET_TIMER
Added in API level 19
public static final String ACTION_SET_TIMER
Activity Action: Set a timer.
Activates an existing timer or creates a new one.
This action requests a timer to be started for a specific length of time.
Use the Alarm Clock to create a timer using:
Intent setTimer = new Intent(AlarmClock.ACTION_SET_TIMER);
setTimer.putExtra(AlarmClock.EXTRA_LENGTH, 60);
setTimer.putExtra(AlarmClock.EXTRA_MESSAGE, "My Amazing timer");
setTimer.putExtra(AlarmClock.EXTRA_SKIP_UI, false);
startActivity(setTimer);
I just need to put this into appinventor2 ActivityStarter component!!
what am i missing?? im confused..
AlarmClock documentation indicates Applications that wish to receive the ACTION_SET_ALARM and ACTION_SET_TIMER Intents should create an activity to handle the Intent that requires the permission com.android.alarm.permission.SET_ALARM. The AS may not work unless the Manifiest sets the permission. I don’t know.
ok, you like to set a timer and not an alarm...
you probably need to be able to set the time as long value...
this extension is able to do it Activity Starter Extension by pepemont, which additionally is able to pass boolean and long values
but…it worked only one or two times…i try to explain…i gave 25 seconds,compiled the apk,installed,launch and…tadahhhhhh…timer set to 25 seconds!!.almost fell off my chair!! …
but…every time i go back to app,and press b_start again, it doesnt work…call the timer,but ignore ExtraValue.
Rebuilt inAI,changin seconds to 30…noway…00 again…then i add the extra_skip…true,false…and after some attempts…it works,but with 25 seconds…
im getting mad !!..
.according to:
“public static final String ACTION_SET_TIMER
Activity Action: Set a timer.
Activates an existing timer or creates a new one.
This action requests a timer to be started for a specific length of time. If no length is specified, the implementation should start an activity that is capable of setting a timer (EXTRA_SKIP_UI is ignored in this case). If a length is specified, and EXTRA_SKIP_UI is true, the implementation should remove this timer after it has been dismissed. If an identical, unused timer exists matching both parameters, an implementation may re-use it instead of creating a new one (in this case, the timer should not be removed after dismissal). This action always starts the timer.”
so it seems the skip_ui the problem…
another problem is that the timer doesnt fire…it call the timer but doesnt start it…sooo…lot of problem so far…
your blocks look strange... but if it works it's fine...
you are using the deprecated ExtraValue property which usually has been used together with the ExtraKey property... ExtraKey would be EXTRA_LENGTH and ExtraValue would be 30 in the example
why don't you use the Extras property together with lists of lists correctly?
the SKIP UI expects a boolean value and the default acrivity starter is not able to do that... see again what I said earlier
Taifun
PS: I probably will add the Set Timer method into the alarm extension if I find some time...
I think the problem is merely the syntax and how the AI2 AS translate (compile) the text into code..
"EXTRA_LENGTH"..with or without "".??..with the comma or without? the number should be passed as text or number??....we have to prefix with the "android.intent.action." for every extras..????
and so on..
We need a documentation for the ActivityStarter component that explain HOW it translate into code.
Should be nice to "open" the generated apk and see inside..
but im not a programmer..so my adventure ends here..
it's hard to experiment when you have so few clues bout a language..
now..i decompiled the apk with a online tool..the result is a 21 MB zip with dozens of folders and subfolders: