BUG: app.StartApp()

109 views
Skip to first unread message

Samueljh1 Youtube

unread,
Mar 21, 2015, 5:39:22 AM3/21/15
to androi...@googlegroups.com
OK, I really need a fix this as my app users are waiting for a big update. At the moment I cant release it because of a bug...

In the DroidScript app, app.StartApp() works fine.

When I build the APK:

I try app.StartApp(), no errors pop up.

Then, the animation of an app opening appears (like normal).

Then, instead of the app opening, it just disappears and the original app stays there. Basically: its not opening.

Why? And how can I fix this?? If this is a bug, could you please fix this ASAP!

Thanks ;)

Samueljh1 Youtube

unread,
Mar 21, 2015, 5:40:38 AM3/21/15
to androi...@googlegroups.com
I need a fix as*

Samueljh1 Youtube

unread,
Mar 21, 2015, 6:19:50 AM3/21/15
to androi...@googlegroups.com
Edit: It Opens the Current app, but not the one I specified.

Dave Smart

unread,
Mar 21, 2015, 2:00:26 PM3/21/15
to androi...@googlegroups.com
Hi Samuel,

Have you got the latest version of DroidScript and the latest ApkBulder ?

Samueljh1 Youtube

unread,
Mar 21, 2015, 2:45:37 PM3/21/15
to androi...@googlegroups.com
Yea!

Steve Garman

unread,
Mar 21, 2015, 7:27:46 PM3/21/15
to androi...@googlegroups.com
Samueljh1, could you post the exact line(s) of code you are using to call app.StartApp, please.

Could you also build an apk from the following app, run the resulting app and let us know what it displays.


//Called when application is started.
function OnStart()
{
    s = app.GetDSVersion();
    app.SetClipboardText(s);
    app.Alert(s);
}

Samueljh1 Youtube

unread,
Mar 22, 2015, 1:10:24 PM3/22/15
to androi...@googlegroups.com
It returned 1.21 I hope this helps!

Samueljh1 Youtube

unread,
Mar 24, 2015, 8:58:13 AM3/24/15
to androi...@googlegroups.com
I tried if(e == "Herobrine's Return") app.StartApp("Herobrine.js");

And it should work. There is a bug. 100%

Christoph Stehl

unread,
Mar 24, 2015, 4:57:20 PM3/24/15
to androi...@googlegroups.com
app.StartApp need the full path for example:
app.StartApp( "sdcard/DroidScript/Hero/Hero.js");

Samueljh1 Youtube

unread,
Mar 24, 2015, 4:58:20 PM3/24/15
to androi...@googlegroups.com
You don't. I have tried that, the same bug occurs

Steve Garman

unread,
Mar 24, 2015, 5:41:49 PM3/24/15
to androi...@googlegroups.com
I think I can replicate the problem Samuel is seeing.

I don't know if this is a bug or not because I don't know if it is supposed to work but the behaviour is definitely different between the IDE and the apk

I have an app called app1 and in the same project beside app1.js I have app2.js

app1 attempts to start app2.js
In the ide, this appears to work (although app2 cannot report an accurate app.GetAppPath()).

However, from the apk, app2.js is rerun.

The code I have in app1.js is:

//Called when application is started.
function OnStart()
{
    //Create a layout with objects vertically centered.
    lay = app.CreateLayout( "linear", "VCenter,FillXY" );    

    //Create a text label and add it to layout.
    txt = app.CreateText( "app1" );
    txt.SetTextSize( 32 );
    lay.AddChild( txt );
    
    //Add layout to app.    
    app.AddLayout( lay );
    setTimeout(loadapp,10000)
}

function loadapp()
{
    newapp = app.GetAppPath()+
      "/app2.js";
    app.StartApp(newapp)
}



There is an spk with both files at.
http://hudl.sgarman.net/public/spk/app1.spk

Selo Soft

unread,
Mar 24, 2015, 5:48:51 PM3/24/15
to androi...@googlegroups.com
Hi Steve.
Droidscript not install your spk files. ver.1.21b my DS.

Steve Garman

unread,
Mar 24, 2015, 5:50:51 PM3/24/15
to androi...@googlegroups.com
Sorry, there is a serious typo in my report

from the apk, app2.js is rerun,
should read
from the apk, app1.js is rerun

Selo Soft

unread,
Mar 24, 2015, 6:03:25 PM3/24/15
to androi...@googlegroups.com
app.StartApp 
This method only works in DS .
 Work outside the DS .
 I do not know if it works with the APK file?

Steve Garman

unread,
Mar 24, 2015, 6:04:23 PM3/24/15
to androi...@googlegroups.com
I have always assumed that app.StartApp is not supposed to work on a device that does not have DroidScript installed.

I have also always assumed that the .js file that is called needs to be the main file in a DroidScript project of the same name.

Am I wrong?

Steve Garman

unread,
Mar 24, 2015, 6:12:31 PM3/24/15
to androi...@googlegroups.com
Even this doesn't work from an apk on a device with DroidScript installed.


//Called when application is started.
function OnStart()
{
    //Create a layout with objects vertically centered.
    lay = app.CreateLayout( "linear", "VCenter,FillXY" );    

    //Create a text label and add it to layout.
    txt = app.CreateText( "app1" );
    txt.SetTextSize( 32 );
    lay.AddChild( txt );
    
    //Add layout to app.    
    app.AddLayout( lay );
    setTimeout(loadapp,10000)
}

function loadapp()
{
    newapp = 
"/sdcard/DroidScript/Hello World/Hello World.js";
    app.StartApp(newapp)
}

Dave Smart

unread,
Mar 25, 2015, 6:01:03 AM3/25/15
to androi...@googlegroups.com
OK, thanks guys.  

That appears to be a bug.  I will try to fix it.

The method was originally designed to launch Apps within DroidScript, so I will have to think about the consequences of using it without DroidScript installed.

Regards
David
Reply all
Reply to author
Forward
0 new messages