idiot question "build" vs "connect" in the app

91 views
Skip to first unread message

super aorta

unread,
Nov 20, 2019, 1:45:47 PM11/20/19
to MIT App Inventor Forum
My development cycle goes like this

code
build to QR code
kill app on device
start mit ai companion
scan qr code
download
app
install
open

I think there is a less faffier way vis the "connect to ai companion" drop down - this works once for me and then I don't know how to rebuild and start an new version.

Presumably this is possible?

Also:

My code is getting quite large - is there a sensbile way to manage this (I realise I can collpase code block)?

Ta

TimAI2

unread,
Nov 20, 2019, 2:07:00 PM11/20/19
to MIT App Inventor Forum
Sounds like you are NOT using the companion app to its full potential

Try like this:

On Computer:
Connect > AI2 Companion

On Device:
Scan QR code or type 6 digit code with Companion App

Your app/code will now be live on your device, if you make changes to the blocks or designer (type something in Screen1.Properties About Screen to refresh)
your app on the device updates

When you want to test a compiled version, do as you are doing above:

On Computer:
Build > App (provide QR code)

On Device:
Scan QR code with Companion App and install

ABG

unread,
Nov 21, 2019, 2:34:33 PM11/21/19
to MIT App Inventor Forum
My code is getting quite large - is there a sensible way to manage this (I realize I can collapse code block)?

We occasionally get a call for help from some one whose project has grown too large to open,
like the fire department called to cut a hole in some glutton's house to lift him out.
 
Use an external backup mechanism with version control, like DropBox, Google Drive, and/or github.
(I have yet to pay a penny for either, because I limit myself.)

Export your .aia files regularly to backup, along with Downloaded .PNG files for your procedures and event blocks.
They can be re-imported individually by drag and drop,

I use the Clean Up Blocks facility regularly, and arrange my blocks in the same order as the Table of Contents of my project doc file.
The Clean Up Blocks vertical arrangement gives me fast scroll wheel access.

To find a procedure definition block fast,
 drag in a temporary call block,
 and follow it to its source via right click option,
 then Undo your way back to delete the temporary call block.

ABG

Gerard Bucas

unread,
Nov 21, 2019, 3:21:04 PM11/21/19
to MIT App Inventor Forum
Hi ABG,

Good advice - fortunate I am doing most of those things! The way you described finding a procedure is great - hadn't thought of that & will definitely use that from now on!

Hovever, I have one project that is > 3000 blocks and the blocks editors becomes a little cumbersome. :)

Quick Question:
Is there a "fast" way to find a "Button Click" (or LongClick) event (something like you described for finding a Procedure)?
That would REALLY help a LOT. Seems that one should be be able to drag a new "Button Click" Block (a duplicate) and then be able to quickly find where the original is used!? Or some other method that I don't know about!? Seems like an added feature that should be added to the Blocks Editor (ie: find a Button Click Event)? Any hope for that?

Regards

Gerard

Gerard Bucas

unread,
Nov 21, 2019, 3:42:15 PM11/21/19
to mitappinv...@googlegroups.com
Just "discovered" the "Arrange Blocks By Category" in the "Blocks Editor"!

I like it - seems better & more logical that my own attempts to "group" blocks in some "logical" way! :)

super aorta

unread,
Nov 21, 2019, 3:47:08 PM11/21/19
to MIT App Inventor Forum
I suppose what my problem is is that there appears to be no way to split my code across different "files" so everything is piled into one screen (physical monitor).

I realise that there "screens" which would split my code up nicely but the functionality of these means they don't work so at the moment everything is piled into one screen.

I'd like the equivalent of making my source code etc in many files, I suppose a folder or hierarchy of block screens so I can rationally compartmentalise my code. I've only got 50 or so blocks and it feels unmanageable already.

Following the backpack analogy perhaps "satchels" would be the thing? I could have one for startups, one for variables, one for my connection screen or however I wish to carve my code up.  They could easily share the same address space (satchel walls invisible to the code).

I also find using long blocks quite tricky - especially when the are too big to fit on one screen and especially when there are a lot of nest conditionals. It would be nice to be able to collapse the outside of a block but leave the inside expanded and it would be nice if the when calling up options the option box didn't always warp to the bottom of the function (which appear off screen).  It would also be nice to be able to open blocks in separate windows.

For all I know these feature already exist!

Thanks!

Taifun

unread,
Nov 21, 2019, 3:59:52 PM11/21/19
to MIT App Inventor Forum
I also find using long blocks quite tricky - especially when the are too big to fit on one screen and especially when there are a lot of nest conditionals. 

the challenge is to write elegant solutions, i.e. to use as less blocks as possible 
procedures and the advanced features can help you with this

also follow the DRY principle - Don't repeat yourself

Unbenannt.JPG



if you want to provide an example screenshot of your relevant blocks, we can think about how it could be improved...

Taifun

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

Taifun

unread,
Nov 21, 2019, 4:03:10 PM11/21/19
to mitappinv...@googlegroups.com
concerning DRY, see also Enis' example here http://twodogapps.com/?page_id=686#Procedures
Taifun

super aorta

unread,
Nov 21, 2019, 5:03:28 PM11/21/19
to MIT App Inventor Forum
Yep, I understand all that - I'm an experienced programmer with many years experience.

I'm just finding the lack of options to handle my growing code base a bit daunting.

If this was a written language I'd have sub-divided my code two or three times by now.

Despite it being relatively small amount of code it is beginning to feel like an unruly beast (which is a shame because the scratch paradigm works very nicely). I could see my code base for a single app expanding 3-5 times and right now I feel the only viable solution is a bigger monitor (impractical).

Taifun

unread,
Nov 21, 2019, 5:11:24 PM11/21/19
to MIT App Inventor Forum
keep the blocks collapsed and organized and open only those blocks you are currently working with
Taifun

super aorta

unread,
Nov 21, 2019, 5:18:57 PM11/21/19
to MIT App Inventor Forum
Got that - ok it doesn't sound like I've missed anything obvious and just have to put up with a massive monolithic work space!

Thanks for the help!

ABG

unread,
Nov 21, 2019, 5:21:45 PM11/21/19
to MIT App Inventor Forum
Is there a "fast" way to find a "Button Click" (or LongClick) event (something like you described for finding a Procedure)?
 
The error finding triangular buttons can be used to find event blocks, if you duplicate them to trigger an error.

ABg

ABG

unread,
Nov 21, 2019, 5:29:07 PM11/21/19
to MIT App Inventor Forum
Also consider using table-based approaches, turning blocks into data.

The Any component blocks are powerful, and can be used with generic events
to cut down on code, like in this project ...

ABG

Gerard Bucas

unread,
Nov 21, 2019, 5:41:00 PM11/21/19
to MIT App Inventor Forum
Niiiice....! :)

Good ideas - will help a lot with large projects.

Thanks !

ABG

unread,
Nov 22, 2019, 12:01:43 PM11/22/19
to MIT App Inventor Forum
(added to new AppInventor Performance section of FAQ)
ABG

Reply all
Reply to author
Forward
0 new messages