[Tip] Make your app start at boot up inside DS with Wifi enabled

260 views
Skip to first unread message

Dave Smart

unread,
Oct 4, 2017, 2:10:40 PM10/4/17
to androi...@googlegroups.com
Put the following lines at the bottom of your OnStart function:-

    app.SetAutoBoot( true );
    app.SetAutoWifi( true );
    app.SetAutoStart( "MyAppName" );


This is particularly useful for testing 'headless' devices like Android TV boxes, AndroidThings devices or Kiosk/Machine UI tablets during development.  Doing this will automatically turn on WiFi, run DS and then your app at reboot or re-power.  You can then remotely connect to the device with the Wifi editor and inspect logs or update your code etc.

Emma Nevada

unread,
Oct 6, 2017, 3:39:35 PM10/6/17
to DroidScript
autoWifi enables the Wi-Fi editor?

Steve Garman

unread,
Oct 7, 2017, 4:15:36 AM10/7/17
to androi...@googlegroups.com
@Emma,
autoWifi starts the Wi-Fi server, so you can connect from the Wi-Fi IDE without needing to manually press the Wi-Fi Connect button on the phone.

Jo Elegolo

unread,
Mar 11, 2021, 11:47:21 AM3/11/21
to DroidScript
@Dave: I have a serious issue with this nice feature. Though I thought I did enable automatic wifi at the ide, the ide-wifi is not enabled or, at least, has not enough time to initiate wifi. The app ("MyAppName") starts all over when I try to bring DS to foreground, so I am not able to connect to the ide and do anything with it.
The whole system is blocked by the "MyAppName" app and I can do nothing but use the app or perfom system settings. Thats pretty good for the fully tested end version, when development is done ... but thats not the case now. Stopping the app shows DS for a short time then immediately the app is restarted
( Android 5.1.1 on Samsung Note3 Neo used, DS version is 1.80X - X for testing SMS - due to problems with 2.06, I have premium account )
I got out of this unusable situation only by deinstalling/reinstalling DS.
Then again, after definitely having set the Auto-Wifi mode and tested its coming up on DS start - Wifi is set automatically after a few seconds - I reproduced the behavior written above by starting the app ('your' 3 lines coding implemented at the end of the OnStart function) out of the IDE (PC connected to DS via WiFi): Whenever I 'stop' the app by back-key (put it to background), DS pops up, showing WiFi as obviously off for about 1 second then the app comes to foreground again. Status of IDE (PC browser) shows "Disconnected", no chance to connect and do any development.
When I use the system task switcher machanism,  the behavior is identic.

(It might be essential that the program I use has more than 1 program files, but I did not test the simple case.)

So, I can escape this situation by deinstalling/reinstalling DS as a workaround, but unfortunately, the mechanism itself can't be used as proposed by you, Dave. Or did I do something wrong?

Best regards
Jo
Message has been deleted

Jo Elegolo

unread,
Mar 15, 2021, 2:54:08 PM3/15/21
to DroidScript
(sorry, repeated with minor correction)
Another system - another issue. Using Android 9 with DS 2.06, the (local WiFi) online development works great with
    app.SetAutoBoot( true );
    app.SetAutoWifi( true );
    app.SetAutoStart( "DroidScript" );
    app.SetAutoStart( "Luise3" );
at the end of OnStart(){...}
Issue: I've added SetAutoStart for DroidScript hoping to force automatic boot for the whole thing, as it did not without, but it is still not working (DS must be started manually, then the app is started at once, in contrary to the issues I have with A 5.1.1 the IDE is connective and works well here - see prevoius posting).
As I need automatic startup for this project, here my question:
Do I additionally have to grant permission of any kind and how can I give that?
I'll try to use SetAlarm to get what I want ...

Regards
Jo

Jo Elegolo

unread,
Mar 15, 2021, 6:15:30 PM3/15/21
to DroidScript
By the way: Breaking the IDE-connection stops the running app. So this can only be used for development.

Dave

unread,
Mar 17, 2021, 7:40:22 AM3/17/21
to DroidScript
Hi Jo,

You can only have one Auto-start app, so you need to have just app.SetAutoStart(."Luise3" )

(Note: in DS 2.06 the function has been renamed to ide.SetAutoStart, same with ide.AutoWifi, but the old ones still work )

Also, recent versions of android have options in the settings to block or allow auto-start of various apps, you will need to check that Android is not stopping DS from starting at boot.

Reply all
Reply to author
Forward
0 new messages