2017년 3월 2일 목요일

Re: [App Inventor Open Source Development] Announcing App Inventor Extension Components


The MIT App Inventor team is delighted to announce the availability of Extension Components for testing. We hope the Extension Components  will prove to be a major enhancement to App Inventor:   Extensions provide a way for anyone to build their own App Inventor components, which others can then use in creating apps.   This should be of special interest to the App Inventor open source group.

App Inventor is free and open software, so people have always been able to build personal systems and install their own components.   But until now, the only way to make those components available to others has been to create and maintain a personal App Inventor server  that has those components built in.

Extension components, in contrast, can be loaded dynamically into any App Inventor system, so they can be shared and imported into projects as needed.   For example, educators and educational software developers to provide extension components tailored to specific lessons and activities, so that students can have these available in building apps.  Examples might be simulations or tools for large-scale data analysis, or image recognition.  Those features might be unfeasible to implement with the built-in App Inventor blocks, either because of processing speed or programming complexity.   But the same capability might be readily implemented using extension components that encapsulate the necessary processing.

Anyone can create extension components. This requires gaining some familiarity with the App Inventor source code (located on Github) and programming in Java.   Once you create an extension component, you can share it with anyone for use in their App Inventor projects.   Extension components can be housed anywhere on the Web.   They need not be stored at MIT or any other special place, although MIT hosts a repository where people can make extension components available for sharing and public use.

Today, we’re releasing a test server for App Inventor that supports the Extension Components feature.   You can find it at extension-test.appinventor.mit.edu.  There’s also a document called App Inventor Extensions that explains how to create and use Extension Components.

With extensions, the range of App Inventor features can be expanded enormously.   We hope that people will explore this tool to build new capabilities for App Inventor and their creations.



The implementation of App Inventor Extension Components is the work students who participated with the MIT App Inventor team in through Google Summer of Code: Ethan Hon, Justus Raju, and Mouhamadou Sall.   Other summer GSoC App Inventor participants in 2015 are Devid Farinelli, Yucun Li, and  Shruti Rijhwani.  All of them are extraordinarily talented, and the entire App Inventor community is in their debt.

--
where is the extention test site code as I want to use it offline 

--
the source code is in the cdk-v0.1 branch here https://github.com/mit-cml/appinventor-sources/tree/cdk-v0.1
and don't hesitate to take a look at the document... everythng you need to know about Extensions is in there...

--
what do i do to put this on a google cloud site as now you have to do this: 

--
see my answer in your other thread https://groups.google.com/d/msg/app-inventor-open-source-dev/z-Id1Zc8QCQ/IPMUgx9LBwAJ
and as Jos already said: Please stop opening threads for the same question. Thank you.

--
This is great.. but is there a guide on how to create the extensions ? Sorry if that has been answered in past

--
Both of these  are linked from the documentation pages:


--
Very, very cool.  Thanks for sharing Hal.  I may need to dust off my java programming book!

--

It's been 10 months since I've touch the AI source code. Anyway after breaking 6 ribs and punching a lung just before christmas due to a mountain biking accident I had (My own fault really as I am not 20years old and don't bounce but go splat when I hit the floor, should have left my stablisers on the bike) I had time play with google cardboard and I have plenty on new ideas I want to work on this year as extension components for AI. My idea is to give support for Google Cardboard in AI and managed to create a basic project in the standard AI to create an app the work with the cardboard using 2 canvas. Just to get back into to the swing of things I needed a GyroSensor component for head track and luckily there is one already created in the UCR branch of MTL git which saved me the work, so I have compile this as extension component and have created a demo AI project which is attached. The project is pretty basic but demonsrtates the gyro sensor in the phone working. 

How to use the project:
1) Lay the phone flat then start the app
2) Rotate the phone clockwise to make ball bigger 
3) Rotate the phone anticlockwise to make the ball smaller
4) Tilt the phone left, right , up & down to move the ball 

I have also attached the mrGryoSesor.AIX component for people to play with if they want.



CDK Questions I hope someone can help with
1) Last year when I created my Sphero component as an AIX components unfortunately it couldn't be used as it has native libraries which are required and at the time native libraries weren't supported by AIX. I am keen to supply my mrSphero.aix and was wandering if it is possible to add native library support to component extensions. I am happy to do the leg work on this but will need a bit of guidance on how to include the native library support to the AIX file. If anyone can help it will be greatly appreciated

2) Is any work being done on supporting visible Extension Components?  I would love share a load of my visible components such as custom buttons, Panels, Gaming canvas, etc but until visible components are supported in AIX files I can't really.  

I will be converting my sound components and a few other non-visible components to AIX components so people can play with them if they like.



--
great to hear, that you are back... I didn't know, that you had an accident...

and was wandering if it is possible to add native library support to component extensions.
yes, you can add external libraries, see also the documentation chapter 4.2.3 "Using external libraries"  http://ai2.appinventor.mit.edu/reference/other/extensions.html
and as example see the SoundAnalysis Extension http://appinventor.mit.edu/extensions/

--
btw. you might want to use your own package name for your extensions...

--
Cool to hear that you're back working on AI.
I also want to know if visibile extensions are in the works.
It would be really helpful to have visibile extensions to extend AI functionalities.

I'll have a look at your gyro extension, looks very interesting to me.

--
Gareth,
That's awful to hear about your accident.  I'm glad you're recovering.
It would be great to have cardboard as an extension.   I don't know how difficult that would be - I had a couple of MIT students look at cardboard last year, but they did not make much progress.   Hopefully things will be better this year.
Please keep us all updated no your progress (health plus hacking).
We're not going to do anything with visible extension components until the non-visible ones have settled down - and even then, it will be a lot of work.  Think about what you would actually need in an extension and maybe there's another way.
Stay in touch

--
Accidents seem to be an annual christmas experience over the last few years for me. Only good thing is I have manage to have extra long christmas breaks even though I have been able to do my job at home. Hopefully I won't have another injury as I think I have now had my fair share, 3 major incidents in total over the last 4 chrismas periods (Pace maker christmas 4 years ago, appendicitis last chrismas and now broken ribs this christmas)

Taifun - Cheers for the info I have changed my package name. Also noticed the following in the doc


  • It must be a non-visible component.   (Keep in mind that “non-visible” here refers to visibility in the App Inventor designer, not visibility on the phone screen.   You can still create components that use anything in the Android SDK and produce visible results in the app on the phone; they just won’t appear in the designer screen.)

This information is interesting and very useful to know. I will have a play with this and see if I can make my mrCanvas component which is a visible component into a AIX file.


I have now converted my mrSound component to an AIX file and managed to use it in conjunction with the gyroSensor component to create another demo project which I've attached to this post.
The project is used with Google Cardboard and the head tracking allow you to change the direction of the sound. 

How to use the Google Cardboard Demo Project
1) Put you phone in Google Cardboard and attach a set of head phones.
2) The sound is coming from the direction of the red ball on the screen. Turn you head from left to right and the sound direction will change from the left to the right ear.
3) Move you head up and down will increase and decease the size of the ball and volume given the illusion of the ball move further and closer to you

Even though the project is quite basic, it demonstrates the possiblity of introducing Google Cardboard to AI.

I have attached the project and the mrSound.AIX so you can test them both out. For instructions on using the component visit my website and go to the help and resource page www.themadrobot.talktalk.net


Why I need to make my mrCanvas as a AIX next is because there are limitations on the current Canvas component such as imagesprite and balls not being able to move beyond the boundary of the canvas borders which is really needed for Google Cardboard also I have put loads of other feature on my mrCanvas which are great for gaming.

Will keep you posted how I get on.




--
Hi, Glad all is well and that you have recovered.

I had a look at cardboard also, but its set for having API 16+ only.

--
API 16+ thats a pity but no a major set back I can still do it with a bit of bendy think. Won't be as nice as using the proper API but I should be able to get a going with a  work around.

I notice when I compile the CDK source I get an error. The error is when it tries to build the Companion app. Is anyone else find the same issue. I am using Windows 7 64bit and compile a fresh version of the CDK branch. Currently I use the companion downloaded from the CDK test site.

ant clean
ant

This is the error I get:


CommonVersion:
AndroidRuntime:
Barcode:
ComponentList:
BuildServer:
CheckPlayApp:
PlayApp:
     [java] Jan 07, 2016 6:06:03 PM com.google.appinventor.buildserver.ProjectBu
ilder build
     [java] INFO: temporary project root: C:\Users\GarethH.GLOBAL\AppData\Local\
Temp\1452189963125_0.6111258198049001-0
     [java] Jan 07, 2016 6:06:03 PM com.google.appinventor.buildserver.ProjectBu
ilder extractProjectFiles
     [java] INFO: extracting C:\Users\GarethH.GLOBAL\AppData\Local\Temp\14521899
63125_0.6111258198049001-0\android.keystore from input zip
     [java] Jan 07, 2016 6:06:03 PM com.google.appinventor.buildserver.ProjectBu
ilder extractProjectFiles
     [java] INFO: extracting C:\Users\GarethH.GLOBAL\AppData\Local\Temp\14521899
63125_0.6111258198049001-0\assets\AI2Companion-Icon.png from input zip
     [java] Jan 07, 2016 6:06:03 PM com.google.appinventor.buildserver.ProjectBu
ilder extractProjectFiles
     [java] INFO: extracting C:\Users\GarethH.GLOBAL\AppData\Local\Temp\14521899
63125_0.6111258198049001-0\assets\Instructions.png from input zip
     [java] Jan 07, 2016 6:06:03 PM com.google.appinventor.buildserver.ProjectBu
ilder extractProjectFiles
     [java] INFO: extracting C:\Users\GarethH.GLOBAL\AppData\Local\Temp\14521899
63125_0.6111258198049001-0\assets\Title.png from input zip
     [java] Jan 07, 2016 6:06:03 PM com.google.appinventor.buildserver.ProjectBu
ilder extractProjectFiles
     [java] INFO: extracting C:\Users\GarethH.GLOBAL\AppData\Local\Temp\14521899
63125_0.6111258198049001-0\assets\connectwCode.png from input zip
     [java] Jan 07, 2016 6:06:03 PM com.google.appinventor.buildserver.ProjectBu
ilder extractProjectFiles
     [java] INFO: extracting C:\Users\GarethH.GLOBAL\AppData\Local\Temp\14521899
63125_0.6111258198049001-0\assets\connectwQR.png from input zip
     [java] Jan 07, 2016 6:06:03 PM com.google.appinventor.buildserver.ProjectBu
ilder extractProjectFiles
     [java] INFO: extracting C:\Users\GarethH.GLOBAL\AppData\Local\Temp\14521899
63125_0.6111258198049001-0\assets\mooning.png from input zip
     [java] Jan 07, 2016 6:06:03 PM com.google.appinventor.buildserver.ProjectBu
ilder extractProjectFiles
     [java] INFO: extracting C:\Users\GarethH.GLOBAL\AppData\Local\Temp\14521899
63125_0.6111258198049001-0\src\edu\mit\appinventor\aicompanion3\Screen1.bky from
 input zip
     [java] Jan 07, 2016 6:06:03 PM com.google.appinventor.buildserver.ProjectBu
ilder extractProjectFiles
     [java] INFO: extracting C:\Users\GarethH.GLOBAL\AppData\Local\Temp\14521899
63125_0.6111258198049001-0\src\edu\mit\appinventor\aicompanion3\Screen1.scm from
 input zip
     [java] Jan 07, 2016 6:06:03 PM com.google.appinventor.buildserver.ProjectBu
ilder extractProjectFiles
     [java] INFO: extracting C:\Users\GarethH.GLOBAL\AppData\Local\Temp\14521899
63125_0.6111258198049001-0\src\edu\mit\appinventor\aicompanion3\Screen1.yail fro
m input zip
     [java] Jan 07, 2016 6:06:03 PM com.google.appinventor.buildserver.ProjectBu
ilder extractProjectFiles
     [java] INFO: extracting C:\Users\GarethH.GLOBAL\AppData\Local\Temp\14521899
63125_0.6111258198049001-0\youngandroidproject\project.properties from input zip


     [java] java.lang.NullPointerException
     [java]     at com.google.common.base.Preconditions.checkNotNull(Preconditio
ns.java:191)
     [java]     at com.google.common.io.Resources$UrlByteSource.<init>(Resources
.java:77)
     [java]     at com.google.common.io.Resources$UrlByteSource.<init>(Resources
.java:72)
     [java]     at com.google.common.io.Resources.asByteSource(Resources.java:66
)
     [java]     at com.google.common.io.Resources.asCharSource(Resources.java:11
1)
     [java]     at com.google.common.io.Resources.toString(Resources.java:136)
     [java]     at com.google.appinventor.buildserver.ProjectBuilder.getAllCompo
nentTypes(ProjectBuilder.java:238)
     [java]     at com.google.appinventor.buildserver.ProjectBuilder.build(Proje
ctBuilder.java:166)
     [java]     at com.google.appinventor.buildserver.Main.main(Main.java:82)


BUILD FAILED
C:\Dropbox\AI\appinventor-sources\appinventor\build.xml:21: The following error
occurred while executing this line:
C:\Dropbox\AI\appinventor-sources\appinventor\buildserver\build.xml:192: Java re
turned: 1
Total time: 6 minutes 28 seconds
C:\Dropbox\AI\appinventor-sources\appinventor [cdk-v0.1 +0 ~0 -4]>


The line causing the issue is point to  the following highlighted in red
<!-- =====================================================================
       PlayApp: builds ../build/buildserver/AppInventorCompanion.apk
       ===================================================================== -->
  <target name="PlayApp"
          depends="CheckPlayApp"
          unless="PlayApp.uptodate">
    <java classname="com.google.appinventor.buildserver.Main" fork="true" failonerror="true">
      <classpath>
        <fileset dir="${run.lib.dir}" includes="*.jar" />
      </classpath>
      <sysproperty key="file.encoding" value="UTF-8" />
      <arg value="--inputZipFile" />
      <arg value="${local.build.dir}/aiplayapp.zip" />
      <arg value="--userName" />
      <arg value="App Inventor" />
      <arg value="--isForCompanion" />
      <arg value="--outputDir" />
      <arg value="${public.build.dir}" />
      <arg value="--dexCacheDir" />
      <arg value="${public.build.dir}/dexCache" />
    </java>
  </target>

I can start the app engine but I just can seem to build the companion from the CDK branch.

--
yes, I get the same error (Windows 8.1, 64 bit and also on Windows 10, 64 bit), this seems to be a Windows issue...
I already reported that error in November here https://groups.google.com/d/msg/app-inventor-dev/vA_qic8TE80/a29HdsjLBQAJ
I therefore only run "ant extensions" and test my extensions on the extension test server directly

btw. it probably would be a good idea to start a new thread next time... 

--
Sorry Taifun I should have started a new thread for this issue. The link to the post you made isn't working for me 
https://groups.google.com/d/msg/app-inventor-dev/vA_qic8TE80/a29HdsjLBQAJ ?

--
Could anyone port an echo and live mic to speaker function to AIX Extension :) Like Gareth's Mr sound from the mad robot test server, I despretly need a echo effect for a project i am working on, Any help would be greatly appreciated. 

--
so why don't you use Gareth's extension then?

--
I am using this already :) It does the pitch and Balance L-R But no echo like the one on the Gareth's test server,, I am still trying to figure out how to make extensions But this feature would be Epic :) 

--
Admob Extesion

I want to share with you the admob component

quiero compartir con ustedes el componente admob



--
Did anyone prove the extension of admob?

--
Note:  One limitation of the current extension component implementation is that it creates non-visible components only (i.e., components that do not show on the designer screen).   MIT plans to remove this restriction in future versions of the extension component system.

an admob extension would be a visible component

--
I would like to clone a pre-existing extension and modify it slightly particularly the canvas extension how would I go about finding this code?

--
What about the position time when im hearing the song..? what about info of rthe complete time of the song?

--
What about the position time when im hearing the song..? what about info of rthe complete time of the song?
try the player extension here https://puravidaapps.com/player.php

--

users uploading files like jpeg or mp3


is there a way to create an online database that users can upload files to through the app..one the app can call on and vise versa.i have a live streaming app that i want local artists to upload their songs to so they can be played later on the stream

--
yes, you can use your own web server to store the files

--

Create app more than 5 mb


I have such problem. My app includes many mp3 and jpeg files (about 600). Total amount 300 mb. 
Question#1:
I tried do in such way but server error. Can you tell me what limit is of my aia file which can be loaded in such way?
Question#1:
I know another way to load files http://puravidaapps.com/filebyfile.php, but loaded files are in a folder, that is open for a user. I want that my files were able to use only throught my app. If no decision for question #1, how to protect files acording to decision #2?

--
Let's say that you can create an apktool that is 300mb. How are you going to publish it? Also there will not be that many people that will download such a huge app.

-- 
You have two question 1s there!

1.:  5MB will be your limit.  That's the size of your AIA file... after that, things get wonky.

1.:  You can't really.  You have no ability to add things to the assets folder after you've packaged the app...

--
5Mb is the aia limit.  300Mb ?  Impossible with AI2 if you need to save them in the assets.

To hide the files from a user, you have to put them in assets.  But you can not put that many files into assets.

Perhaps you should be compiling your app with Eclipse or Android Studio?

Yes, you have a problem.  You can not do what you want with AI2 and keep your files 'secret.'.

--
the limit is ~5 MB
300MB will not be possible
as far as I know, there is no possibility to hide the downloaded files
alternatively you can use Hosseins solution, which is also mentioned on my webpage, but I think, there is also a maximum for apk files somewhere...

--
Thanks to everybody for attention to my problem. As I understood in my situation only one way - Webprefetch File by File

--
You Can Do This In Next Way:
1. Insert In Aia Fake Mp3 FileS with Small Sizes
2.after Compile open this Apk And Repack Your with aPkmaker (if I do not forgoten it), Insert Original Files And Size of your apk will Be 300mb.

--
You can create apk file more than 5mb! But You can use fake files.
on this video(in russian) you can see how it can be made https://www.youtube.com/watch?v=EP4-9PEU6pk
Idea:
1.  use short mp3 files with original filenames, as example 1.mp3, 2.mp3...
2. Compile it.
3. With apkmaker script repack it and upload to apk original mp3s which has same names...)))



--
Thank you so much. I'll try it and write after...

--