Skip to first unread message

Appsbeheerder

unread,
Feb 13, 2017, 4:53:47 AM2/13/17
to mitappinv...@googlegroups.com
TIP: Use an automatic solution!
Using assets in App Inventor always asks your attention when changing from development to production. The path to the assets is different. It is most of the time solved with a global variable, to be set manually to TRUE or FALSE, to know which path to follow during development of production. I tend to forget the manual setting, finding out during the run of the apk that I have forgotten to change the setting... But I have found a solution with an App Inventor extension: Taifun Tools extension. Taifun's comment: "Nice trick..."
Enjoy my solution.

Assets path during development and production
Development of the app:

file:///mnt/sdcard/AppInventor/assets/<your_html_file>.html


Production, before packaging the app:

file:///android_asset/<your_html_file>.html
oplossing automatische assets verwijzing in App Inventor-export.png

Taifun

unread,
Feb 13, 2017, 7:31:40 AM2/13/17
to MIT App Inventor Forum
Nice trick! Thank you for sharing...
Taifun

Taifun

unread,
Feb 21, 2017, 9:28:06 AM2/21/17
to MIT App Inventor Forum
I now added a new method into the tools extension https://puravidaapps.com/tools.php, which gives you always the correct path to the assets. Enjoy!


Returns the path to the assets. This method is useful, if you want to access files from the webviewer component stored in the assets of the app.
 
The method will return
  • file:///android_asset/ in case the app is running after building the app as apk file 
  • and will return file:///mnt/sdcard/AppInventor/assets/ in case the app is running inside the companion app (development mode).

Taifun

Abraham Getzler

unread,
Feb 21, 2017, 12:47:33 PM2/21/17
to MIT App Inventor Forum
Reply all
Reply to author
Forward
0 new messages