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

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.

@SteveJG

Yes, but bringing in Taifun’s Alarm extension resolves the SET_ALARM permissions requirement.

I can get the timer to open with activityStarter, but not with any of the extras on board

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

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Tried that, same result a with normal activity Starter:
(variable skip is text block = false)
No error message generated by activity Starter

Calling the activity without the extras opens the clock

Timai2, you got the point...

and obviously including the Taifun alarm extension to bypass the permission settings,
It should work..!!!

the problem is how to pass the seconds (and/or other parameters) via extras syntax !!

btw,how did you configured the ActivityStarter properties in the Designer?? mine are all empty..maybe this is the problem...

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?