Clock stops when lockscreen, ActivityStarter workaround with com.android.deskclock

I tryed this:
AS_2

and i have this error:

Tips?

  1. You need to spell length correctly (lenght)
  2. It needs to be a list of pairs (see my example - make a list > make a list)
  3. The documentation indicates: android.intent.extra.alarm.LENGTH
  4. You can leave the designer boxes empty, all settings are made in the blocks
1 Like

Timai2,
could you please provide image of working blocks,setting ie 25 seconds??

I don’t have working blocks, see my previous posts

Ok,i made it work!!

workin_sumtimes_blocks

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...

Done!

And it doesn't work..open the timer, no extras..

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..

That would be great!!

without everything

it looks fine as you have it... you might want to experiment yourself a little bit...

as you found out yourself previously: no... if in doubt, do some experiments...

and don't use the logik true block, use a text block and just write true inside...

Taifun

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:

any idea where to start looking for the the code?

What about trying the suggestions from my latest answer? What about providing an updated screenshot of your relevant blocks?

And to find out how the activity starter is working under the hood, take a look at the sources…
https://mit-cml.github.io/appinventor-sources/

Taifun

A post was split to a new topic: App required to work when the device locked

6 posts were split to a new topic: How to implement some functions in my App to make it work when the screen is locked?

Hi all, i have read the post about setting up ACTION_SET_TIMER
(Clock stops when lockscreen, ActivityStarter workaround with com.android.deskclock)

However, it seems there is no solution in the post. After 2 years, I encounter the same problem.
ActivityStarter1.Action to > "android.intent.action.SET_TIMER"
ActivityStarter1.Extras to > make a list > make a list "android.intent.extra.alarm.LENGTH" and 120 (number)
ActivityStarter1.StartActivity

and nothing setup. (I have edited the manifest to add the permission of set alarm)

However, using TaifunAlarm extension works. So, I don't understand what is the difference.

Second question:
is it possible to have skip_ui in dismiss_alarm action? or any ways to dismiss alarm and switch back to the own app?

I now moved your contribution to the other thread and opened it again...

please provide a screenshot of your relevant blocks to avoid misunderstandings
see also my lastest answer here in post #29 Clock stops when lockscreen, ActivityStarter workaround with com.android.deskclock - #29 by Taifun

and: let me suggest to use the already mentioned alarm extension, which is able to do it...

Taifun


Here is the screenshot. If no Extras, it will open the clock, but when there is extras, it has nothing pop out or timer setup.
I have also tired 120(number), "120"(string), still the same behaviour

The activity starter component is not able to pass nuneric or boolean values, only strings...

As already suggested earlier, try the activity starter extension... it has been updated recently, see here

And if you still do not have luck..., the paid version of the alarm extension can already do what you need... .

Question to ask yourself: why would someone spend valuable time to develop an extension, if it could be done without extension?

Taifun

Thank you very much your suggestions!
I would like to learn why my own problem didn't but the extension works, you suggested a good way for me to explore more.

May I switch to another question here:

  1. Can we "delete" system alarm instead only dismiss it?
  2. Can we dismiss alarm without UI or auto switch back to app?

see the features of the Alarm Clock API here AlarmClock  |  Android Developers

to cancel/dismiss an alarm, see Q3 here App Inventor Extensions: Alarm | Pura Vida Apps

which means without activity starter... currently not, because my extension does not offer that feature... note: I do not plan to add this...

Taifun