? function restart ?

203 views
Skip to first unread message

Bernd

unread,
Apr 29, 2017, 5:00:12 PM4/29/17
to DroidScript
hi alls,
is there a way to restart the app with inbuild function?
...i dont want to script a fakerestart like
lay.destroy or so,
it will be fine to close the app
app.exit
and start it in same line...
app.restart
for example..
is there a small way to do it?
thank you
Bernd

Steve Garman

unread,
Apr 29, 2017, 5:09:22 PM4/29/17
to DroidScript

function restart()
{
var now = new Date().getTime();
app.SetAlarm( "Set", 7985, null, now + 2000 );
app.Exit( );
}

Bernd

unread,
Apr 30, 2017, 2:30:12 AM4/30/17
to DroidScript
Thank you Steve :)

on wiki i cant find any descriptions...
so, what means
id?
on wiki samples there are using the id
1234
insteed of your id.

...the code looks like a good way, but
it will open an .html
i only have .js
can i change it?
the rest of the code is easy to understanding, only the fact
it will open a .html and the different ids i cant understand.

thank you and sunny greetings from Berlin
Bernd

Bernd

unread,
Apr 30, 2017, 3:37:26 AM4/30/17
to DroidScript
ok, i featured out:
id is the identifier for this alarm line
the value doesnt matter for the function alarm...it can use in callback function for example.

but i cant find out how it opens .js instead of .html

Steve Garman

unread,
Apr 30, 2017, 3:52:16 AM4/30/17
to DroidScript
Can you post an spk showing the problem please.

Alarm should just start the app.

I could make guesses about what the problem might be but I would expect them to cause bigger problems than just the alarm.

Bernd

unread,
Apr 30, 2017, 4:29:11 AM4/30/17
to DroidScript
hi Steve, thank you for the info :)

i found out:
running the app directly from droidscript, the code works fine.

when i run the code in
icodego
i will get the alert
cant find ...html

then i start my app again directly from droidscript, the problem still is until i restart my device and run it at first direct from droidscript, than alls works fine again.

now i build a test app with only one button for calling the function...
same happend...in ds all works fine, in
icodego
doesnt work...alert
cant find...html


Steve Garman

unread,
Apr 30, 2017, 4:42:36 AM4/30/17
to DroidScript
I expect that is something to do with the hoops IcodeGO has to jump through to catch the debug information when an error occurs.

I will be really impressed if Chris manages to fix it but the restart function is a hack that is implemented without ICG in mind.

Chris

unread,
Apr 30, 2017, 8:33:19 AM4/30/17
to DroidScript
Try with error reporting off. But it shouldn't technically hinder a restart.

Looking into it now.

Chris

unread,
Apr 30, 2017, 8:52:41 AM4/30/17
to DroidScript
Steve is correct. It has to do with the error reporting wrapper. What happens is, your app has the ICG wrapper when running in error mode. For that brief two seconds when the app restarts, it reopens ICG and removes the wrapper. Your alarm calls the app - its actually looking for the wrapper.

Error mode off, works as expected.

Since I also like Steve's hack, I will fix it, but, it will only have a time frame of "5" seconds. I will wait in ICG for 5 seconds to remove the wrapper, and onresume will restart that 5 second count. Hacking a hack. Impressed @Steve? (Hey, you said it) :-)

For now, Run your app with error reporting off, and only turn it on if you need to 'find' your error...

This is a hack to restart, and not a bug on ICG's part.

Chris

Steve Garman

unread,
Apr 30, 2017, 9:29:05 AM4/30/17
to DroidScript
Not as impressed as I expected to be, Chris.

It seems I am so used to you overcoming all obstacles that it has now become anticlimactic ;)

Bernd

unread,
Apr 30, 2017, 10:13:36 AM4/30/17
to DroidScript
now works fine :)

thank you both :)

Reply all
Reply to author
Forward
Message has been deleted
0 new messages